diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index aaa49ac785..6f762ff5d1 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -3,7 +3,7 @@ "isRoot": true, "tools": { "jetbrains.resharper.globaltools": { - "version": "2025.3.4", + "version": "2026.1.0.1", "commands": [ "jb" ], diff --git a/JsonApiDotNetCore.slnx.DotSettings b/JsonApiDotNetCore.slnx.DotSettings index 4b9c881ac2..8c39c0abcc 100644 --- a/JsonApiDotNetCore.slnx.DotSettings +++ b/JsonApiDotNetCore.slnx.DotSettings @@ -9,7 +9,6 @@ swagger.json SOLUTION True - True SUGGESTION SUGGESTION SUGGESTION @@ -17,6 +16,7 @@ SUGGESTION SUGGESTION SUGGESTION + WARNING SUGGESTION SUGGESTION SUGGESTION @@ -38,6 +38,7 @@ SUGGESTION SUGGESTION HINT + DO_NOT_SHOW WARNING WARNING WARNING @@ -76,8 +77,11 @@ WARNING SUGGESTION WARNING + WARNING + WARNING WARNING DO_NOT_SHOW + DO_NOT_SHOW WARNING WARNING WARNING @@ -96,14 +100,16 @@ SUGGESTION WARNING True + ShowAndRun SUGGESTION False - <?xml version="1.0" encoding="utf-16"?><Profile name="JADNC Full Cleanup"><XMLReformatCode>True</XMLReformatCode><CSCodeStyleAttributes ArrangeTypeAccessModifier="True" ArrangeTypeMemberAccessModifier="True" SortModifiers="True" RemoveRedundantParentheses="True" AddMissingParentheses="True" ArrangeBraces="True" ArrangeAttributes="True" ArrangeArgumentsStyle="True" ArrangeCodeBodyStyle="True" ArrangeVarStyle="True" ArrangeTrailingCommas="True" ArrangeObjectCreation="True" ArrangeDefaultValue="True" ArrangeNamespaces="True" ArrangeNullCheckingPattern="True" /><CssAlphabetizeProperties>True</CssAlphabetizeProperties><JsInsertSemicolon>True</JsInsertSemicolon><FormatAttributeQuoteDescriptor>True</FormatAttributeQuoteDescriptor><CorrectVariableKindsDescriptor>True</CorrectVariableKindsDescriptor><VariablesToInnerScopesDescriptor>True</VariablesToInnerScopesDescriptor><StringToTemplatesDescriptor>True</StringToTemplatesDescriptor><JsReformatCode>True</JsReformatCode><JsFormatDocComments>True</JsFormatDocComments><RemoveRedundantQualifiersTs>True</RemoveRedundantQualifiersTs><OptimizeImportsTs>True</OptimizeImportsTs><OptimizeReferenceCommentsTs>True</OptimizeReferenceCommentsTs><PublicModifierStyleTs>True</PublicModifierStyleTs><ExplicitAnyTs>True</ExplicitAnyTs><TypeAnnotationStyleTs>True</TypeAnnotationStyleTs><RelativePathStyleTs>True</RelativePathStyleTs><AsInsteadOfCastTs>True</AsInsteadOfCastTs><HtmlReformatCode>True</HtmlReformatCode><AspOptimizeRegisterDirectives>True</AspOptimizeRegisterDirectives><RemoveCodeRedundancies>True</RemoveCodeRedundancies><CSUseAutoProperty>True</CSUseAutoProperty><CSMakeFieldReadonly>True</CSMakeFieldReadonly><CSMakeAutoPropertyGetOnly>True</CSMakeAutoPropertyGetOnly><CSArrangeQualifiers>True</CSArrangeQualifiers><CSFixBuiltinTypeReferences>True</CSFixBuiltinTypeReferences><CssReformatCode>True</CssReformatCode><CSOptimizeUsings><OptimizeUsings>True</OptimizeUsings></CSOptimizeUsings><CSShortenReferences>True</CSShortenReferences><CSReformatCode>True</CSReformatCode><CSharpFormatDocComments>True</CSharpFormatDocComments><CSReorderTypeMembers>True</CSReorderTypeMembers><XAMLCollapseEmptyTags>False</XAMLCollapseEmptyTags><CSReformatInactiveBranches>True</CSReformatInactiveBranches><CSharpReformatComments>True</CSharpReformatComments></Profile> + <?xml version="1.0" encoding="utf-16"?><Profile name="JADNC Full Cleanup"><XMLReformatCode>True</XMLReformatCode><CSCodeStyleAttributes ArrangeTypeAccessModifier="True" ArrangeTypeMemberAccessModifier="True" SortModifiers="True" RemoveRedundantParentheses="True" AddMissingParentheses="True" ArrangeBraces="True" ArrangeAttributes="True" ArrangeArgumentsStyle="True" ArrangeCodeBodyStyle="True" ArrangeVarStyle="True" ArrangeTrailingCommas="True" ArrangeObjectCreation="True" ArrangeDefaultValue="True" ArrangeNamespaces="True" ArrangeNullCheckingPattern="True" ArrangeAccessors="True" /><CssAlphabetizeProperties>True</CssAlphabetizeProperties><JsInsertSemicolon>True</JsInsertSemicolon><FormatAttributeQuoteDescriptor>True</FormatAttributeQuoteDescriptor><CorrectVariableKindsDescriptor>True</CorrectVariableKindsDescriptor><VariablesToInnerScopesDescriptor>True</VariablesToInnerScopesDescriptor><StringToTemplatesDescriptor>True</StringToTemplatesDescriptor><JsReformatCode>True</JsReformatCode><JsFormatDocComments>True</JsFormatDocComments><RemoveRedundantQualifiersTs>True</RemoveRedundantQualifiersTs><OptimizeImportsTs>True</OptimizeImportsTs><OptimizeReferenceCommentsTs>True</OptimizeReferenceCommentsTs><PublicModifierStyleTs>True</PublicModifierStyleTs><ExplicitAnyTs>True</ExplicitAnyTs><TypeAnnotationStyleTs>True</TypeAnnotationStyleTs><RelativePathStyleTs>True</RelativePathStyleTs><AsInsteadOfCastTs>True</AsInsteadOfCastTs><HtmlReformatCode>True</HtmlReformatCode><AspOptimizeRegisterDirectives>True</AspOptimizeRegisterDirectives><RemoveCodeRedundancies>True</RemoveCodeRedundancies><CSUseAutoProperty>True</CSUseAutoProperty><CSMakeFieldReadonly>True</CSMakeFieldReadonly><CSMakeAutoPropertyGetOnly>True</CSMakeAutoPropertyGetOnly><CSArrangeQualifiers>True</CSArrangeQualifiers><CSFixBuiltinTypeReferences>True</CSFixBuiltinTypeReferences><CssReformatCode>True</CssReformatCode><CSOptimizeUsings><OptimizeUsings>True</OptimizeUsings></CSOptimizeUsings><CSShortenReferences>True</CSShortenReferences><CSReformatCode>True</CSReformatCode><CSharpFormatDocComments>True</CSharpFormatDocComments><CSReorderTypeMembers>True</CSReorderTypeMembers><XAMLCollapseEmptyTags>False</XAMLCollapseEmptyTags><CSReformatInactiveBranches>True</CSReformatInactiveBranches><CSharpReformatComments>True</CSharpReformatComments></Profile> JADNC Full Cleanup Required Required Required Required + StringEmpty Conditional False False @@ -189,8 +195,7 @@ OnSingleLine False 160 - <?xml version="1.0" encoding="utf-16"?> -<Patterns xmlns="urn:schemas-jetbrains-com:member-reordering-patterns"> + <Patterns xmlns="urn:schemas-jetbrains-com:member-reordering-patterns"> <TypePattern DisplayName="Non-reorderable types" RemoveRegions="All"> <TypePattern.Match> <Or> @@ -214,7 +219,7 @@ <HasMember> <And> <Kind Is="Method" /> - <HasAttribute Name="Xunit.FactAttribute" Inherited="True" /> + <HasAttribute Inherited="True" Name="Xunit.FactAttribute" /> </And> </HasMember> </And> @@ -226,7 +231,7 @@ </And> </Entry.Match> <Entry.SortBy> - <Access Order="Private Internal Protected ProtectedInternal Public" /> + <Access Is="0" Order="Private Internal Protected ProtectedInternal Public" /> </Entry.SortBy> </Entry> <Group DisplayName="Fields"> @@ -239,7 +244,7 @@ </And> </Entry.Match> <Entry.SortBy> - <Access Order="Private Internal Protected ProtectedInternal Public" /> + <Access Is="0" Order="Private Internal Protected ProtectedInternal Public" /> </Entry.SortBy> </Entry> <Entry DisplayName="Static"> @@ -253,7 +258,7 @@ </And> </Entry.Match> <Entry.SortBy> - <Access Order="Private Internal Protected ProtectedInternal Public" /> + <Access Is="0" Order="Private Internal Protected ProtectedInternal Public" /> </Entry.SortBy> </Entry> <Entry DisplayName="Instance Readonly"> @@ -267,7 +272,7 @@ </And> </Entry.Match> <Entry.SortBy> - <Access Order="Private Internal Protected ProtectedInternal Public" /> + <Access Is="0" Order="Private Internal Protected ProtectedInternal Public" /> </Entry.SortBy> </Entry> <Entry DisplayName="Instance"> @@ -283,7 +288,7 @@ </And> </Entry.Match> <Entry.SortBy> - <Access Order="Private Internal Protected ProtectedInternal Public" /> + <Access Is="0" Order="Private Internal Protected ProtectedInternal Public" /> </Entry.SortBy> </Entry> </Group> @@ -296,7 +301,7 @@ </And> </Entry.Match> <Entry.SortBy> - <Access Order="Private Internal Protected ProtectedInternal Public" /> + <Access Is="0" Order="Private Internal Protected ProtectedInternal Public" /> </Entry.SortBy> </Entry> <Entry DisplayName="Instance"> @@ -309,7 +314,7 @@ </And> </Entry.Match> <Entry.SortBy> - <Access Order="Private Internal Protected ProtectedInternal Public" /> + <Access Is="0" Order="Private Internal Protected ProtectedInternal Public" /> </Entry.SortBy> </Entry> </Group> @@ -320,7 +325,7 @@ </And> </Entry.Match> <Entry.SortBy> - <Access Order="Private Internal Protected ProtectedInternal Public" /> + <Access Is="0" Order="Private Internal Protected ProtectedInternal Public" /> </Entry.SortBy> </Entry> <Group DisplayName="Events"> @@ -332,7 +337,7 @@ </And> </Entry.Match> <Entry.SortBy> - <Access Order="Private Internal Protected ProtectedInternal Public" /> + <Access Is="0" Order="Private Internal Protected ProtectedInternal Public" /> </Entry.SortBy> </Entry> <Entry DisplayName="Instance"> @@ -345,7 +350,7 @@ </And> </Entry.Match> <Entry.SortBy> - <Access Order="Private Internal Protected ProtectedInternal Public" /> + <Access Is="0" Order="Private Internal Protected ProtectedInternal Public" /> </Entry.SortBy> </Entry> </Group> @@ -360,7 +365,7 @@ </Or> </Entry.Match> <Entry.SortBy> - <Kind Order="Constructor" /> + <Kind Is="0" Order="Constructor" /> </Entry.SortBy> </Entry> <Entry DisplayName="Test methods" Priority="100"> @@ -391,7 +396,7 @@ </And> </Entry.Match> <Entry.SortBy> - <Access Order="Private Internal Protected ProtectedInternal Public" /> + <Access Is="0" Order="Private Internal Protected ProtectedInternal Public" /> </Entry.SortBy> </Entry> <Entry DisplayName="Nested types"> @@ -408,7 +413,7 @@ </And> </Entry.Match> <Entry.SortBy> - <Access Order="Private Internal Protected ProtectedInternal Public" /> + <Access Is="0" Order="Private Internal Protected ProtectedInternal Public" /> </Entry.SortBy> </Entry> <Group DisplayName="Fields"> @@ -421,7 +426,7 @@ </And> </Entry.Match> <Entry.SortBy> - <Access Order="Private Internal Protected ProtectedInternal Public" /> + <Access Is="0" Order="Private Internal Protected ProtectedInternal Public" /> </Entry.SortBy> </Entry> <Entry DisplayName="Static"> @@ -435,7 +440,7 @@ </And> </Entry.Match> <Entry.SortBy> - <Access Order="Private Internal Protected ProtectedInternal Public" /> + <Access Is="0" Order="Private Internal Protected ProtectedInternal Public" /> </Entry.SortBy> </Entry> <Entry DisplayName="Instance Readonly"> @@ -449,7 +454,7 @@ </And> </Entry.Match> <Entry.SortBy> - <Access Order="Private Internal Protected ProtectedInternal Public" /> + <Access Is="0" Order="Private Internal Protected ProtectedInternal Public" /> </Entry.SortBy> </Entry> <Entry DisplayName="Instance"> @@ -465,7 +470,7 @@ </And> </Entry.Match> <Entry.SortBy> - <Access Order="Private Internal Protected ProtectedInternal Public" /> + <Access Is="0" Order="Private Internal Protected ProtectedInternal Public" /> </Entry.SortBy> </Entry> </Group> @@ -478,7 +483,7 @@ </And> </Entry.Match> <Entry.SortBy> - <Access Order="Private Internal Protected ProtectedInternal Public" /> + <Access Is="0" Order="Private Internal Protected ProtectedInternal Public" /> </Entry.SortBy> </Entry> <Entry DisplayName="Instance"> @@ -491,7 +496,7 @@ </And> </Entry.Match> <Entry.SortBy> - <Access Order="Private Internal Protected ProtectedInternal Public" /> + <Access Is="0" Order="Private Internal Protected ProtectedInternal Public" /> </Entry.SortBy> </Entry> </Group> @@ -502,7 +507,7 @@ </And> </Entry.Match> <Entry.SortBy> - <Access Order="Private Internal Protected ProtectedInternal Public" /> + <Access Is="0" Order="Private Internal Protected ProtectedInternal Public" /> </Entry.SortBy> </Entry> <Group DisplayName="Events"> @@ -514,7 +519,7 @@ </And> </Entry.Match> <Entry.SortBy> - <Access Order="Private Internal Protected ProtectedInternal Public" /> + <Access Is="0" Order="Private Internal Protected ProtectedInternal Public" /> </Entry.SortBy> </Entry> <Entry DisplayName="Instance"> @@ -527,7 +532,7 @@ </And> </Entry.Match> <Entry.SortBy> - <Access Order="Private Internal Protected ProtectedInternal Public" /> + <Access Is="0" Order="Private Internal Protected ProtectedInternal Public" /> </Entry.SortBy> </Entry> </Group> @@ -550,7 +555,7 @@ </And> </Entry.Match> <Entry.SortBy> - <Access /> + <Access Is="0" /> </Entry.SortBy> </Entry> </Group> @@ -571,7 +576,7 @@ </And> </Entry.Match> <Entry.SortBy> - <Access Order="Private Internal Protected ProtectedInternal Public" /> + <Access Is="0" Order="Private Internal Protected ProtectedInternal Public" /> </Entry.SortBy> </Entry> <Entry DisplayName="Nested types"> diff --git a/src/Examples/DapperExample/TranslationToSql/Builders/SqlQueryBuilder.cs b/src/Examples/DapperExample/TranslationToSql/Builders/SqlQueryBuilder.cs index 5d3fc634da..ec8d360087 100644 --- a/src/Examples/DapperExample/TranslationToSql/Builders/SqlQueryBuilder.cs +++ b/src/Examples/DapperExample/TranslationToSql/Builders/SqlQueryBuilder.cs @@ -452,7 +452,7 @@ private void AppendOnNewLine(string? value, StringBuilder builder) builder.AppendLine(); } - builder.Append(new string(' ', _indentDepth * 4)); + builder.Append(' ', _indentDepth * 4); builder.Append(value); } } diff --git a/src/JsonApiDotNetCore/AtomicOperations/Processors/AddToRelationshipProcessor.cs b/src/JsonApiDotNetCore/AtomicOperations/Processors/AddToRelationshipProcessor.cs index e84756120a..6afe0cd518 100644 --- a/src/JsonApiDotNetCore/AtomicOperations/Processors/AddToRelationshipProcessor.cs +++ b/src/JsonApiDotNetCore/AtomicOperations/Processors/AddToRelationshipProcessor.cs @@ -26,7 +26,7 @@ public AddToRelationshipProcessor(IAddToRelationshipService serv var leftId = (TId)operation.Resource.GetTypedId(); ISet rightResourceIds = operation.GetSecondaryResources(); - await _service.AddToToManyRelationshipAsync(leftId!, operation.Request.Relationship!.PublicName, rightResourceIds, cancellationToken); + await _service.AddToToManyRelationshipAsync(leftId, operation.Request.Relationship!.PublicName, rightResourceIds, cancellationToken); return null; } diff --git a/src/JsonApiDotNetCore/AtomicOperations/Processors/DeleteProcessor.cs b/src/JsonApiDotNetCore/AtomicOperations/Processors/DeleteProcessor.cs index 406aca10b0..3212f17985 100644 --- a/src/JsonApiDotNetCore/AtomicOperations/Processors/DeleteProcessor.cs +++ b/src/JsonApiDotNetCore/AtomicOperations/Processors/DeleteProcessor.cs @@ -24,10 +24,7 @@ public DeleteProcessor(IDeleteService service) ArgumentNullException.ThrowIfNull(operation); var id = (TId)operation.Resource.GetTypedId(); -#pragma warning disable CS8607 // A possible null value may not be used for a type marked with [NotNull] or [DisallowNull] - // Justification: Temporary workaround for R# bug at https://youtrack.jetbrains.com/issue/RSRP-503026. await _service.DeleteAsync(id, cancellationToken); -#pragma warning restore CS8607 // A possible null value may not be used for a type marked with [NotNull] or [DisallowNull] return null; } diff --git a/src/JsonApiDotNetCore/AtomicOperations/Processors/RemoveFromRelationshipProcessor.cs b/src/JsonApiDotNetCore/AtomicOperations/Processors/RemoveFromRelationshipProcessor.cs index 81c4eb93ee..aef8be9626 100644 --- a/src/JsonApiDotNetCore/AtomicOperations/Processors/RemoveFromRelationshipProcessor.cs +++ b/src/JsonApiDotNetCore/AtomicOperations/Processors/RemoveFromRelationshipProcessor.cs @@ -26,7 +26,7 @@ public RemoveFromRelationshipProcessor(IRemoveFromRelationshipService rightResourceIds = operation.GetSecondaryResources(); - await _service.RemoveFromToManyRelationshipAsync(leftId!, operation.Request.Relationship!.PublicName, rightResourceIds, cancellationToken); + await _service.RemoveFromToManyRelationshipAsync(leftId, operation.Request.Relationship!.PublicName, rightResourceIds, cancellationToken); return null; } diff --git a/src/JsonApiDotNetCore/AtomicOperations/Processors/SetRelationshipProcessor.cs b/src/JsonApiDotNetCore/AtomicOperations/Processors/SetRelationshipProcessor.cs index 913068a26c..ec667ce6a4 100644 --- a/src/JsonApiDotNetCore/AtomicOperations/Processors/SetRelationshipProcessor.cs +++ b/src/JsonApiDotNetCore/AtomicOperations/Processors/SetRelationshipProcessor.cs @@ -27,7 +27,7 @@ public SetRelationshipProcessor(ISetRelationshipService service) var leftId = (TId)operation.Resource.GetTypedId(); object? rightValue = GetRelationshipRightValue(operation); - await _service.SetRelationshipAsync(leftId!, operation.Request.Relationship!.PublicName, rightValue, cancellationToken); + await _service.SetRelationshipAsync(leftId, operation.Request.Relationship!.PublicName, rightValue, cancellationToken); return null; } diff --git a/src/JsonApiDotNetCore/Diagnostics/CascadingCodeTimer.cs b/src/JsonApiDotNetCore/Diagnostics/CascadingCodeTimer.cs index 48109b4c98..6a3fbbf676 100644 --- a/src/JsonApiDotNetCore/Diagnostics/CascadingCodeTimer.cs +++ b/src/JsonApiDotNetCore/Diagnostics/CascadingCodeTimer.cs @@ -263,7 +263,7 @@ private void WriteResult(StringBuilder builder, int indent, TimeSpan timeElapsed private static void WriteIndent(StringBuilder builder, int indent) { - builder.Append(new string(' ', indent * 2)); + builder.Append(' ', indent * 2); } private void WritePadding(StringBuilder builder, int indent, int paddingLength) diff --git a/src/JsonApiDotNetCore/Middleware/JsonApiMiddleware.cs b/src/JsonApiDotNetCore/Middleware/JsonApiMiddleware.cs index c29eed6301..621653188e 100644 --- a/src/JsonApiDotNetCore/Middleware/JsonApiMiddleware.cs +++ b/src/JsonApiDotNetCore/Middleware/JsonApiMiddleware.cs @@ -98,7 +98,7 @@ public async Task InvokeAsync(HttpContext httpContext, IJsonApiRequest request) if (CodeTimingSessionManager.IsEnabled && _logger.IsEnabled(LogLevel.Information)) { string timingResults = CodeTimingSessionManager.Current.GetResults(); - string requestMethod = httpContext.Request.Method.Replace(Environment.NewLine, ""); + string requestMethod = httpContext.Request.Method.Replace(Environment.NewLine, string.Empty); string requestUrl = httpContext.Request.GetEncodedUrl(); LogMeasurement(requestMethod, requestUrl, Environment.NewLine, timingResults); } diff --git a/src/JsonApiDotNetCore/Queries/Expressions/SortExpression.cs b/src/JsonApiDotNetCore/Queries/Expressions/SortExpression.cs index 68033328aa..f845f27943 100644 --- a/src/JsonApiDotNetCore/Queries/Expressions/SortExpression.cs +++ b/src/JsonApiDotNetCore/Queries/Expressions/SortExpression.cs @@ -48,7 +48,7 @@ public override string ToString() public override string ToFullString() { - return $"{string.Join(',', Elements.Select(child => child.ToFullString()))}{(IsAutoGenerated ? " (auto-generated)" : "")}"; + return $"{string.Join(',', Elements.Select(child => child.ToFullString()))}{(IsAutoGenerated ? " (auto-generated)" : string.Empty)}"; } public override bool Equals(object? obj) diff --git a/src/JsonApiDotNetCore/Queries/IndentingStringWriter.cs b/src/JsonApiDotNetCore/Queries/IndentingStringWriter.cs index e5f39b6c77..bdb49ccdf0 100644 --- a/src/JsonApiDotNetCore/Queries/IndentingStringWriter.cs +++ b/src/JsonApiDotNetCore/Queries/IndentingStringWriter.cs @@ -12,7 +12,7 @@ public void WriteLine(string? line) { if (_indentDepth > 0) { - _builder.Append(new string(' ', _indentDepth * 2)); + _builder.Append(' ', _indentDepth * 2); } _builder.AppendLine(line); diff --git a/src/JsonApiDotNetCore/Serialization/Request/JsonApiReader.cs b/src/JsonApiDotNetCore/Serialization/Request/JsonApiReader.cs index 9c0139d949..3884960215 100644 --- a/src/JsonApiDotNetCore/Serialization/Request/JsonApiReader.cs +++ b/src/JsonApiDotNetCore/Serialization/Request/JsonApiReader.cs @@ -42,7 +42,7 @@ public JsonApiReader(IJsonApiOptions options, IDocumentAdapter documentAdapter, if (_logger.IsEnabled(LogLevel.Trace)) { - string requestMethod = httpRequest.Method.Replace(Environment.NewLine, ""); + string requestMethod = httpRequest.Method.Replace(Environment.NewLine, string.Empty); string requestUrl = httpRequest.GetEncodedUrl(); LogRequest(requestMethod, requestUrl, requestBody); } diff --git a/src/JsonApiDotNetCore/Serialization/Response/JsonApiWriter.cs b/src/JsonApiDotNetCore/Serialization/Response/JsonApiWriter.cs index 66dcaedf29..587c7b6d0b 100644 --- a/src/JsonApiDotNetCore/Serialization/Response/JsonApiWriter.cs +++ b/src/JsonApiDotNetCore/Serialization/Response/JsonApiWriter.cs @@ -65,7 +65,7 @@ public async Task WriteAsync(object? model, HttpContext httpContext) if (_logger.IsEnabled(LogLevel.Trace)) { - string requestMethod = httpContext.Request.Method.Replace(Environment.NewLine, ""); + string requestMethod = httpContext.Request.Method.Replace(Environment.NewLine, string.Empty); string requestUrl = httpContext.Request.GetEncodedUrl(); LogResponse(requestMethod, requestUrl, responseBody, httpContext.Response.StatusCode); } diff --git a/test/DiscoveryTests/ServiceDiscoveryFacadeTests.cs b/test/DiscoveryTests/ServiceDiscoveryFacadeTests.cs index 0b1fa3a8d3..2e0974da50 100644 --- a/test/DiscoveryTests/ServiceDiscoveryFacadeTests.cs +++ b/test/DiscoveryTests/ServiceDiscoveryFacadeTests.cs @@ -29,7 +29,7 @@ public void Can_add_resources_from_assembly_to_graph() Action addAction = facade => facade.AddAssembly(typeof(Person).Assembly); // Act - _services.AddJsonApi(discovery: facade => addAction(facade)); + _services.AddJsonApi(discovery: addAction); // Assert ServiceProvider serviceProvider = _services.BuildServiceProvider(); @@ -49,7 +49,7 @@ public void Can_add_resource_from_current_assembly_to_graph() Action addAction = facade => facade.AddCurrentAssembly(); // Act - _services.AddJsonApi(discovery: facade => addAction(facade)); + _services.AddJsonApi(discovery: addAction); // Assert ServiceProvider serviceProvider = _services.BuildServiceProvider(); @@ -66,7 +66,7 @@ public void Can_add_resource_service_from_current_assembly_to_container() Action addAction = facade => facade.AddCurrentAssembly(); // Act - _services.AddJsonApi(discovery: facade => addAction(facade)); + _services.AddJsonApi(discovery: addAction); // Assert ServiceProvider serviceProvider = _services.BuildServiceProvider(); @@ -82,7 +82,7 @@ public void Can_add_resource_repository_from_current_assembly_to_container() Action addAction = facade => facade.AddCurrentAssembly(); // Act - _services.AddJsonApi(discovery: facade => addAction(facade)); + _services.AddJsonApi(discovery: addAction); // Assert ServiceProvider serviceProvider = _services.BuildServiceProvider(); @@ -98,7 +98,7 @@ public void Can_add_resource_definition_from_current_assembly_to_container() Action addAction = facade => facade.AddCurrentAssembly(); // Act - _services.AddJsonApi(discovery: facade => addAction(facade)); + _services.AddJsonApi(discovery: addAction); // Assert ServiceProvider serviceProvider = _services.BuildServiceProvider(); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Sorting/SortTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Sorting/SortTests.cs index 413f18b91e..de556d5f9d 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Sorting/SortTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Sorting/SortTests.cs @@ -312,10 +312,10 @@ public async Task Can_sort_on_multiple_fields_in_multiple_scopes() blogs[0].Posts[1].Caption = "A"; blogs[0].Posts[2].Caption = "A"; blogs[0].Posts[3].Caption = "C"; - blogs[0].Posts[0].Url = ""; + blogs[0].Posts[0].Url = string.Empty; blogs[0].Posts[1].Url = "www.some2.com"; blogs[0].Posts[2].Url = "www.some1.com"; - blogs[0].Posts[3].Url = ""; + blogs[0].Posts[3].Url = string.Empty; blogs[0].Posts[0].Comments = _fakers.Comment.GenerateSet(3); blogs[0].Posts[0].Comments.ElementAt(0).CreatedAt = 1.January(2015).AsUtc(); diff --git a/test/JsonApiDotNetCoreTests/UnitTests/QueryStringParameters/PaginationParseTests.cs b/test/JsonApiDotNetCoreTests/UnitTests/QueryStringParameters/PaginationParseTests.cs index 9c102f5d15..9841e0fc47 100644 --- a/test/JsonApiDotNetCoreTests/UnitTests/QueryStringParameters/PaginationParseTests.cs +++ b/test/JsonApiDotNetCoreTests/UnitTests/QueryStringParameters/PaginationParseTests.cs @@ -182,7 +182,7 @@ public void Reader_Read_Pagination_Succeeds(string? pageNumber, string? pageSize ResourceFieldChainExpression?[] scopeTrees = constraints.Select(expressionInScope => expressionInScope.Scope).ToArray(); scopeTrees.Should().HaveSameCount(scopeTreesExpectedArray); - scopeTrees.Select(tree => tree?.ToString() ?? "").Should().BeEquivalentTo(scopeTreesExpectedArray, options => options.WithStrictOrdering()); + scopeTrees.Select(tree => tree?.ToString() ?? string.Empty).Should().BeEquivalentTo(scopeTreesExpectedArray, options => options.WithStrictOrdering()); string[] valueTreesExpectedArray = valueTreesExpected.Split("|"); QueryExpression[] valueTrees = constraints.Select(expressionInScope => expressionInScope.Expression).ToArray(); diff --git a/test/TestBuildingBlocks/XUnitLoggerProvider.cs b/test/TestBuildingBlocks/XUnitLoggerProvider.cs index 26c15d575b..b9eb8a366d 100644 --- a/test/TestBuildingBlocks/XUnitLoggerProvider.cs +++ b/test/TestBuildingBlocks/XUnitLoggerProvider.cs @@ -145,7 +145,7 @@ private static string GetLogLevelString(LogLevel logLevel) LogLevel.Warning => "WARN", LogLevel.Error => "FAIL", LogLevel.Critical => "CRIT", - LogLevel.None => "", + LogLevel.None => string.Empty, _ => throw new ArgumentOutOfRangeException(nameof(logLevel)) }; }