Skip to content

Commit

Permalink
cleanup of broken unit test (#575)
Browse files Browse the repository at this point in the history
* clean up of broken unit test

* blank line cleanup

* org test clenup

* update testing project
applied nunit analyzers

* az pipeline update .NET sdk version to 6.0.408

* removed unused references

* style rule apply
nuget package rule updates
add nuget symbol package

* sytle clean up
  • Loading branch information
mozts2005 authored May 25, 2023
1 parent 94082b6 commit 77b0ce7
Show file tree
Hide file tree
Showing 79 changed files with 5,531 additions and 5,060 deletions.
16 changes: 4 additions & 12 deletions ci/azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
displayName: 'Use .NET Core sdk'
inputs:
packageType: sdk
version: 3.1.413
useGlobalJson: true
installationPath: $(Agent.ToolsDirectory)/dotnet

- task: DotNetCoreCLI@2
Expand Down Expand Up @@ -120,14 +120,6 @@ jobs:
$date=$(Get-Date -Format "dd MMMM yyyy");
Write-Host "##vso[task.setvariable variable=ReleaseDate]$date"
#- task: NuGetCommand@2
# displayName: 'GitHub Feed (Pre-release)'
# condition: and(succeeded(),eq(variables['IsPrerelease'] ,'True'))
# inputs:
# command: push
# packagesToPush: '$(Pipeline.Workspace)/**/*.nupkg;!$(Pipeline.Workspace)/**/*.symbols.nupkg'
# nuGetFeedType: external
# publishFeedCredentials: 'Github Nuget Feed'
- task: PowerShell@2
displayName: 'GitHub Feed (Pre-release)'
condition: and(succeeded(),eq(variables['IsPrerelease'] ,'True'))
Expand All @@ -141,7 +133,7 @@ jobs:
$url = "$Env:github_feed_url"
Write-Host -ForegroundColor Cyan "Feed url $url"
Write-Host -ForegroundColor Cyan "api key length is " $api.Length
dotnet nuget push "$(Pipeline.Workspace)/**/*.nupkg" --no-symbols --skip-duplicate -k "$api" -s "$url"
dotnet nuget push "$(Pipeline.Workspace)/**/*.nupkg" --skip-duplicate -k "$api" -s "$url"
showWarnings: true
pwsh: true
Expand All @@ -151,7 +143,7 @@ jobs:
condition: and(succeeded(), eq(variables['IsPrerelease'] ,'True'))
inputs:
command: push
packagesToPush: '$(Pipeline.Workspace)/**/*.nupkg;!$(Pipeline.Workspace)/**/*.symbols.nupkg'
packagesToPush: '$(Pipeline.Workspace)/**/*.nupkg'
nuGetFeedType: external
publishFeedCredentials: MyGet

Expand All @@ -160,7 +152,7 @@ jobs:
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/v3.'),eq(variables['IsPrerelease'] ,'False'))
inputs:
command: push
packagesToPush: '$(Pipeline.Workspace)/**/*.nupkg;!$(Pipeline.Workspace)/**/*.symbols.nupkg'
packagesToPush: '$(Pipeline.Workspace)/**/*.nupkg'
nuGetFeedType: external
publishFeedCredentials: Nuget.org

Expand Down
107 changes: 104 additions & 3 deletions src/.editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ charset = utf-8-bom

# Xml project files
[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}]
indent_size = 2
indent_size = 4

# Xml config files
[*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}]
Expand All @@ -28,6 +28,7 @@ indent_size = 2

# Dotnet code style settings:
[*.{cs,vb}]
dotnet_diagnostic.IDE0161.severity = none
trim_trailing_whitespace = true
# Sort using and Import directives with System.* appearing first
dotnet_sort_system_directives_first = true
Expand Down Expand Up @@ -79,10 +80,10 @@ csharp_new_line_before_catch = true
csharp_new_line_before_finally = true
csharp_new_line_before_members_in_object_initializers = true
csharp_new_line_before_members_in_anonymous_types = true
csharp_prefer_simple_using_statement=false:error
csharp_prefer_simple_using_statement= false:error

# IDE0090: Use 'new(...)'
csharp_style_implicit_object_creation_when_type_is_apparent = false
csharp_style_implicit_object_creation_when_type_is_apparent = false:suggestion
# IDE0090: Use 'new(...)'
dotnet_diagnostic.IDE0090.severity = error

Expand Down Expand Up @@ -125,3 +126,103 @@ dotnet_diagnostic.NUnit1002.severity=error
dotnet_diagnostic.NUnit1008.severity=error
dotnet_diagnostic.NUnit1021.severity=error
dotnet_diagnostic.NUnit1028.severity=error
csharp_indent_labels = one_less_than_current
csharp_using_directive_placement = outside_namespace:silent
csharp_prefer_braces = true:silent
csharp_style_namespace_declarations = file_scoped:error
csharp_style_prefer_method_group_conversion = true:silent
csharp_style_prefer_top_level_statements = true:silent
csharp_style_expression_bodied_lambdas = true:silent
csharp_style_expression_bodied_local_functions = false:silent
csharp_style_prefer_null_check_over_type_check = true:suggestion
csharp_style_prefer_local_over_anonymous_function = true:suggestion
csharp_prefer_simple_default_expression = true:suggestion
csharp_style_prefer_range_operator = true:suggestion
csharp_style_prefer_index_operator = true:suggestion
csharp_style_prefer_tuple_swap = true:suggestion
csharp_style_prefer_utf8_string_literals = true:suggestion
csharp_style_deconstructed_variable_declaration = true:suggestion
csharp_style_unused_value_assignment_preference = discard_variable:suggestion
csharp_style_unused_value_expression_statement_preference = discard_variable:silent
csharp_prefer_static_local_function = true:suggestion
csharp_style_prefer_readonly_struct = true:suggestion
csharp_style_prefer_readonly_struct_member = true:suggestion
csharp_style_allow_blank_lines_between_consecutive_braces_experimental = false:error
csharp_style_allow_embedded_statements_on_same_line_experimental = true:silent
csharp_style_allow_blank_line_after_token_in_conditional_expression_experimental = true:silent
csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = true:silent
csharp_style_allow_blank_line_after_token_in_arrow_expression_clause_experimental = true:silent
csharp_style_prefer_switch_expression = true:suggestion
csharp_style_prefer_pattern_matching = true:silent
csharp_style_prefer_not_pattern = true:suggestion
csharp_style_prefer_extended_property_pattern = true:suggestion

[*.{cs,vb}]
#### Naming styles ####

# Naming rules

dotnet_naming_rule.interface_should_be_begins_with_i.severity = suggestion
dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface
dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i

dotnet_naming_rule.types_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.types_should_be_pascal_case.symbols = types
dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case

dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members
dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case

# Symbol specifications

dotnet_naming_symbols.interface.applicable_kinds = interface
dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.interface.required_modifiers =

dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum
dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.types.required_modifiers =

dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.non_field_members.required_modifiers =

# Naming styles

dotnet_naming_style.begins_with_i.required_prefix = I
dotnet_naming_style.begins_with_i.required_suffix =
dotnet_naming_style.begins_with_i.word_separator =
dotnet_naming_style.begins_with_i.capitalization = pascal_case

dotnet_naming_style.pascal_case.required_prefix =
dotnet_naming_style.pascal_case.required_suffix =
dotnet_naming_style.pascal_case.word_separator =
dotnet_naming_style.pascal_case.capitalization = pascal_case

dotnet_naming_style.pascal_case.required_prefix =
dotnet_naming_style.pascal_case.required_suffix =
dotnet_naming_style.pascal_case.word_separator =
dotnet_naming_style.pascal_case.capitalization = pascal_case
dotnet_style_operator_placement_when_wrapping = beginning_of_line
tab_width = 4
end_of_line = crlf
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
dotnet_style_prefer_auto_properties = true:silent
dotnet_style_prefer_simplified_boolean_expressions = true:suggestion
dotnet_style_prefer_conditional_expression_over_assignment = true:silent
dotnet_style_prefer_conditional_expression_over_return = true:silent
dotnet_style_prefer_inferred_tuple_names = true:suggestion
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
dotnet_style_prefer_compound_assignment = true:suggestion
dotnet_style_prefer_simplified_interpolation = true:suggestion
dotnet_style_namespace_match_folder = true:suggestion
dotnet_style_readonly_field = true:suggestion
dotnet_style_require_accessibility_modifiers = for_non_interface_members:silent
dotnet_style_allow_statement_immediately_after_block_experimental = true:silent
dotnet_style_allow_multiple_blank_lines_experimental = false:error
dotnet_code_quality_unused_parameters = all:suggestion
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:silent
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:silent
dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent
2 changes: 1 addition & 1 deletion src/ZendeskApi_v2.Example/ZendeskApi_v2.Example.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<LangVersion>latest</LangVersion>
</PropertyGroup>

Expand Down
8 changes: 4 additions & 4 deletions src/ZendeskApi_v2/Core.cs
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ protected T GenericPagedGet<T>(string resource, int? perPage = null, int? page =

if (parameters.Any())
{
paramString = (resource.Contains("?") ? "&" : "?") + string.Join("&", parameters.Select(x => x.Key + "=" + x.Value).ToArray());
paramString = (resource.Contains('?') ? "&" : "?") + string.Join("&", parameters.Select(x => x.Key + "=" + x.Value).ToArray());
}

return GenericGet<T>(resource + paramString);
Expand Down Expand Up @@ -274,7 +274,7 @@ protected T GenericPagedSortedGet<T>(string resource, int? perPage = null, int?

if (parameters.Any())
{
paramString = (resource.Contains("?") ? "&" : "?") + string.Join("&", parameters.Select(x => x.Key + "=" + x.Value).ToArray());
paramString = (resource.Contains('?') ? "&" : "?") + string.Join("&", parameters.Select(x => x.Key + "=" + x.Value).ToArray());
}

return GenericGet<T>(resource + paramString);
Expand Down Expand Up @@ -489,7 +489,7 @@ protected async Task<T> GenericPagedGetAsync<T>(string resource, int? perPage =

if (parameters.Any())
{
paramString = (resource.Contains("?") ? "&" : "?") + string.Join("&", parameters.Select(x => x.Key + "=" + x.Value));
paramString = (resource.Contains('?') ? "&" : "?") + string.Join("&", parameters.Select(x => x.Key + "=" + x.Value));
}

return await GenericGetAsync<T>(resource + paramString);
Expand Down Expand Up @@ -522,7 +522,7 @@ protected async Task<T> GenericPagedSortedGetAsync<T>(string resource, int? perP

if (parameters.Any())
{
paramString = (resource.Contains("?") ? "&" : "?") + string.Join("&", parameters.Select(x => x.Key + "=" + x.Value));
paramString = (resource.Contains('?') ? "&" : "?") + string.Join("&", parameters.Select(x => x.Key + "=" + x.Value));
}

return await GenericGetAsync<T>(resource + paramString);
Expand Down
5 changes: 2 additions & 3 deletions src/ZendeskApi_v2/Extensions/RequestExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,14 @@ public static int GetEpoch(this DateTime date)

public static Dictionary<string, string> GetQueryStringDict(this string url)
{
var queryPart = !url.Contains("?") ? url : url.Split('?')[1];
var queryPart = !url.Contains('?') ? url : url.Split('?')[1];

return (from match in queryPart.Split('&')
where match.Contains("=")
where match.Contains('=')
select match.Split('='))
.ToDictionary(x => x.First(), x => x.Last());
}


public static string GetQueryString(this Dictionary<string, string> querystringParams)
{
return string.Join("&", querystringParams.Where(q => !q.Value.IsNullOrWhiteSpace()).Select(q => $"{Uri.EscapeDataString(q.Key)}={Uri.EscapeDataString(q.Value)}").ToArray());
Expand Down
1 change: 0 additions & 1 deletion src/ZendeskApi_v2/Models/AccountsAndActivities/Activity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;


namespace ZendeskApi_v2.Models.AccountsAndActivities
{

Expand Down
1 change: 0 additions & 1 deletion src/ZendeskApi_v2/Models/Brands/Brand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,5 @@ public class Brand

[JsonProperty("signature_template")]
public string SignatureTemplate { get; set; }

}
}
1 change: 0 additions & 1 deletion src/ZendeskApi_v2/Models/HelpCenter/Categories/Category.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,4 @@ public class Category
[JsonProperty("translations")]
public IList<Translation> Translations { get; set; }
}

}
1 change: 0 additions & 1 deletion src/ZendeskApi_v2/Models/HelpCenter/Comments/Comment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,4 @@ public class Comment
[JsonProperty("updated_at")]
public string UpdatedAt { get; set; }
}

}
1 change: 0 additions & 1 deletion src/ZendeskApi_v2/Models/HelpCenter/HelpCenterBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,5 @@ public class HelpCenterBase
[JsonProperty("updated_at")]
[JsonConverter(typeof(IsoDateTimeConverter))]
public DateTimeOffset UpdatedAt { get; set; }

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,12 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;


namespace ZendeskApi_v2.Models.HelpCenter.Translations
{
public class GroupTranslationResponse : GroupResponseBase
{

[JsonProperty( "translations" )]
public IList<Translations.Translation> Translations { get; set; }

}
}
1 change: 0 additions & 1 deletion src/ZendeskApi_v2/Models/HelpCenter/Votes/Vote.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,4 @@ public class Vote
[JsonProperty("updated_at")]
public string UpdatedAt { get; set; }
}

}
2 changes: 0 additions & 2 deletions src/ZendeskApi_v2/Models/Search/Result.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,5 @@ public class Result

[JsonProperty("status")]
public string Status { get; set; }


}
}
1 change: 0 additions & 1 deletion src/ZendeskApi_v2/Models/Search/SearchResults.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ public class SearchResults<T> : GroupResponseBase
public object Description { get; set; }
}


public class SearchResults : GroupResponseBase
{
[JsonProperty("prev_page")]
Expand Down
1 change: 0 additions & 1 deletion src/ZendeskApi_v2/Models/Tickets/BaseTicket.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,5 @@ public class BaseTicket : ISearchable
[JsonProperty("updated_at")]
[JsonConverter(typeof(IsoDateTimeConverter))]
public DateTimeOffset? UpdatedAt { get; set; }

}
}
2 changes: 0 additions & 2 deletions src/ZendeskApi_v2/Models/Tickets/Comment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,5 @@ public class Comment
[JsonProperty("created_at")]
[JsonConverter(typeof(IsoDateTimeConverter))]
public DateTimeOffset? CreatedAt { get; set; }

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,5 @@ public class IndividualTicketMetricResponse
{
[JsonProperty("ticket_metric")]
public TicketMetric TicketMetric{ get; set; }

}
}
1 change: 0 additions & 1 deletion src/ZendeskApi_v2/Models/Tickets/TicketField.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ public class TicketFieldBase

[JsonProperty("agent_description")]
public string AgentDescription { get; set; }

}

public class TicketField : TicketFieldBase
Expand Down
1 change: 0 additions & 1 deletion src/ZendeskApi_v2/Models/Tickets/TicketImport.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,5 @@ public class TicketImport : Ticket
[JsonProperty("solved_at")]
[JsonConverter(typeof(IsoDateTimeConverter))]
public DateTimeOffset? SolvedAt { get; set; }

}
}
3 changes: 0 additions & 3 deletions src/ZendeskApi_v2/Models/Tickets/TicketImportComment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,8 @@ public class TicketImportComment
[JsonProperty("value")]
public string Value { get; set; }


[JsonProperty("created_at")]
[JsonConverter(typeof(IsoDateTimeConverter))]
public DateTimeOffset? CreatedAt { get; set; }

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,5 @@ public class GroupUserSegmentResponse : GroupResponseBase

[JsonProperty("topics")]
public IList<Topic> Topics { get; set; }

}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using Newtonsoft.Json;


namespace ZendeskApi_v2.Models.UserSegments
{
public class IndividualUserSegmentResponse
Expand Down
1 change: 0 additions & 1 deletion src/ZendeskApi_v2/Requests/AccountsAndActivity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#endif
using ZendeskApi_v2.Models.AccountsAndActivities;


namespace ZendeskApi_v2.Requests
{
public interface IAccountsAndActivity : ICore
Expand Down
Loading

0 comments on commit 77b0ce7

Please sign in to comment.