diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 2f63c9a5b..64aa56da6 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -3,7 +3,7 @@ "isRoot": true, "tools": { "jetbrains.resharper.globaltools": { - "version": "2024.2.5", + "version": "2024.2.6", "commands": [ "jb" ], @@ -17,7 +17,7 @@ "rollForward": false }, "dotnet-reportgenerator-globaltool": { - "version": "5.3.10", + "version": "5.3.11", "commands": [ "reportgenerator" ], diff --git a/benchmarks/QueryString/QueryStringParserBenchmarks.cs b/benchmarks/QueryString/QueryStringParserBenchmarks.cs index 548c08d53..5e5a65ed9 100644 --- a/benchmarks/QueryString/QueryStringParserBenchmarks.cs +++ b/benchmarks/QueryString/QueryStringParserBenchmarks.cs @@ -31,7 +31,7 @@ public QueryStringParserBenchmarks() var request = new JsonApiRequest { - PrimaryResourceType = resourceGraph.GetResourceType(typeof(QueryableResource)), + PrimaryResourceType = resourceGraph.GetResourceType(), IsCollection = true }; diff --git a/src/Examples/DapperExample/Repositories/DapperRepository.cs b/src/Examples/DapperExample/Repositories/DapperRepository.cs index 23e980613..1da38697d 100644 --- a/src/Examples/DapperExample/Repositories/DapperRepository.cs +++ b/src/Examples/DapperExample/Repositories/DapperRepository.cs @@ -365,7 +365,7 @@ public async Task DeleteAsync(TResource? resourceFromDatabase, [DisallowNull] TI await _resourceDefinitionAccessor.OnWritingAsync(placeholderResource, WriteOperationKind.DeleteResource, cancellationToken); var deleteBuilder = new DeleteResourceStatementBuilder(_dataModelService); - DeleteNode deleteNode = deleteBuilder.Build(ResourceType, placeholderResource.Id!); + DeleteNode deleteNode = deleteBuilder.Build(ResourceType, placeholderResource.Id); CommandDefinition sqlCommand = _dapperFacade.GetSqlCommand(deleteNode, cancellationToken); await ExecuteInTransactionAsync(async transaction => diff --git a/src/JsonApiDotNetCore/Middleware/TraceLogWriter.cs b/src/JsonApiDotNetCore/Middleware/TraceLogWriter.cs index b78670286..70ed7fdd0 100644 --- a/src/JsonApiDotNetCore/Middleware/TraceLogWriter.cs +++ b/src/JsonApiDotNetCore/Middleware/TraceLogWriter.cs @@ -120,7 +120,7 @@ public override void Write(Utf8JsonWriter writer, TWrapper value, JsonSerializer internal sealed partial class TraceLogWriter(ILoggerFactory loggerFactory) : TraceLogWriter { - private readonly ILogger _logger = loggerFactory.CreateLogger(typeof(T)); + private readonly ILogger _logger = loggerFactory.CreateLogger(); public void LogMethodStart(object? parameters = null, [CallerMemberName] string memberName = "") { diff --git a/src/JsonApiDotNetCore/Queries/QueryLayerComposer.cs b/src/JsonApiDotNetCore/Queries/QueryLayerComposer.cs index d030a9546..80125cde5 100644 --- a/src/JsonApiDotNetCore/Queries/QueryLayerComposer.cs +++ b/src/JsonApiDotNetCore/Queries/QueryLayerComposer.cs @@ -390,7 +390,7 @@ public QueryLayer ComposeForUpdate([DisallowNull] TId id, ResourceType prim { ArgumentGuard.NotNull(primaryResourceType); - IImmutableSet includeElements = _targetedFields.Relationships + ImmutableHashSet includeElements = _targetedFields.Relationships .Select(relationship => new IncludeElementExpression(relationship)).ToImmutableHashSet(); AttrAttribute primaryIdAttribute = GetIdAttribute(primaryResourceType); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Creating/CreateResourceTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Creating/CreateResourceTests.cs index c6d2e08e7..5bce7de19 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Creating/CreateResourceTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Creating/CreateResourceTests.cs @@ -114,7 +114,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => PropertyInfo? property = typeof(WorkItem).GetProperty(nameof(Identifiable.Id)); property.ShouldNotBeNull(); - property.PropertyType.Should().Be(typeof(int)); + property.PropertyType.Should().Be(); } [Fact] @@ -162,7 +162,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => PropertyInfo? property = typeof(UserAccount).GetProperty(nameof(Identifiable.Id)); property.ShouldNotBeNull(); - property.PropertyType.Should().Be(typeof(long)); + property.PropertyType.Should().Be(); } [Fact] @@ -207,7 +207,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => PropertyInfo? property = typeof(WorkItemGroup).GetProperty(nameof(Identifiable.Id)); property.ShouldNotBeNull(); - property.PropertyType.Should().Be(typeof(Guid)); + property.PropertyType.Should().Be(); } [Fact] diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Creating/CreateResourceWithClientGeneratedIdTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Creating/CreateResourceWithClientGeneratedIdTests.cs index f6c238147..d4cd2afa1 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Creating/CreateResourceWithClientGeneratedIdTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Creating/CreateResourceWithClientGeneratedIdTests.cs @@ -80,7 +80,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => PropertyInfo? property = typeof(WorkItemGroup).GetProperty(nameof(Identifiable.Id)); property.ShouldNotBeNull(); - property.PropertyType.Should().Be(typeof(Guid)); + property.PropertyType.Should().Be(); } [Theory] @@ -134,7 +134,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => PropertyInfo? property = typeof(WorkItemGroup).GetProperty(nameof(Identifiable.Id)); property.ShouldNotBeNull(); - property.PropertyType.Should().Be(typeof(Guid)); + property.PropertyType.Should().Be(); } [Theory] @@ -185,7 +185,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => PropertyInfo? property = typeof(RgbColor).GetProperty(nameof(Identifiable.Id)); property.ShouldNotBeNull(); - property.PropertyType.Should().Be(typeof(string)); + property.PropertyType.Should().Be(); } [Theory] @@ -236,7 +236,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => PropertyInfo? property = typeof(RgbColor).GetProperty(nameof(Identifiable.Id)); property.ShouldNotBeNull(); - property.PropertyType.Should().Be(typeof(string)); + property.PropertyType.Should().Be(); } [Theory] @@ -292,7 +292,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => PropertyInfo? property = typeof(RgbColor).GetProperty(nameof(Identifiable.Id)); property.ShouldNotBeNull(); - property.PropertyType.Should().Be(typeof(string)); + property.PropertyType.Should().Be(); } [Theory] @@ -475,7 +475,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => PropertyInfo? property = typeof(RgbColor).GetProperty(nameof(Identifiable.Id)); property.ShouldNotBeNull(); - property.PropertyType.Should().Be(typeof(string)); + property.PropertyType.Should().Be(); } [Theory] diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Resources/UpdateResourceTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Resources/UpdateResourceTests.cs index 656f2ab56..42df980d4 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Resources/UpdateResourceTests.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/Updating/Resources/UpdateResourceTests.cs @@ -327,7 +327,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => PropertyInfo? property = typeof(WorkItemGroup).GetProperty(nameof(Identifiable.Id)); property.ShouldNotBeNull(); - property.PropertyType.Should().Be(typeof(Guid)); + property.PropertyType.Should().Be(); } [Fact] @@ -375,7 +375,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext => PropertyInfo? property = typeof(RgbColor).GetProperty(nameof(Identifiable.Id)); property.ShouldNotBeNull(); - property.PropertyType.Should().Be(typeof(string)); + property.PropertyType.Should().Be(); } [Fact] diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/ResourceTypeCaptureStore.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/ResourceTypeCaptureStore.cs index 5d7fa01d5..d3eeaedb6 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/ResourceTypeCaptureStore.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/ResourceTypeCaptureStore.cs @@ -23,13 +23,13 @@ internal void Reset() internal void AssertLeftType() { - LeftDeclaredType.Should().Be(typeof(TLeft)); + LeftDeclaredType.Should().Be(); LeftReflectedTypeName.Should().Be(typeof(TLeft).Name); Request.ShouldNotBeNull(); Request.PrimaryResourceType.ShouldNotBeNull(); - Request.PrimaryResourceType.ClrType.Should().Be(typeof(TLeft)); - Request.Relationship?.LeftType.ClrType.Should().Be(typeof(TLeft)); + Request.PrimaryResourceType.ClrType.Should().Be(); + Request.Relationship?.LeftType.ClrType.Should().Be(); } internal void AssertRightTypes(params Type[] types) diff --git a/test/JsonApiDotNetCoreTests/UnitTests/ResourceDefinitions/CreateSortExpressionFromLambdaTests.cs b/test/JsonApiDotNetCoreTests/UnitTests/ResourceDefinitions/CreateSortExpressionFromLambdaTests.cs index ec78afbd0..607073d7e 100644 --- a/test/JsonApiDotNetCoreTests/UnitTests/ResourceDefinitions/CreateSortExpressionFromLambdaTests.cs +++ b/test/JsonApiDotNetCoreTests/UnitTests/ResourceDefinitions/CreateSortExpressionFromLambdaTests.cs @@ -365,17 +365,17 @@ private abstract class FileSystemEntry : Identifiable public FileSystemEntry Parent { get; set; } = null!; [HasMany] - public IList Children { get; set; } = new List(); + public List Children { get; set; } = []; } [UsedImplicitly(ImplicitUseTargetFlags.Members)] private sealed class DirectoryEntry : FileSystemEntry { [HasMany] - public IList Subdirectories { get; set; } = new List(); + public List Subdirectories { get; set; } = []; [HasMany] - public IList Files { get; set; } = new List(); + public List Files { get; set; } = []; } [UsedImplicitly(ImplicitUseTargetFlags.Members)] diff --git a/test/JsonApiDotNetCoreTests/UnitTests/ResourceGraph/ResourceGraphBuilderTests.cs b/test/JsonApiDotNetCoreTests/UnitTests/ResourceGraph/ResourceGraphBuilderTests.cs index e37c06bb7..de7ac84d1 100644 --- a/test/JsonApiDotNetCoreTests/UnitTests/ResourceGraph/ResourceGraphBuilderTests.cs +++ b/test/JsonApiDotNetCoreTests/UnitTests/ResourceGraph/ResourceGraphBuilderTests.cs @@ -343,7 +343,7 @@ public void Resolves_correct_type_for_lazy_loading_proxy() ResourceType resourceType = resourceGraph.GetResourceType(proxy.GetType()); // Assert - resourceType.ClrType.Should().Be(typeof(ResourceOfInt32)); + resourceType.ClrType.Should().Be(); } [Fact] diff --git a/test/UnitTests/Graph/Implementation.cs b/test/UnitTests/Graph/Implementation.cs index e09848204..c53e55937 100644 --- a/test/UnitTests/Graph/Implementation.cs +++ b/test/UnitTests/Graph/Implementation.cs @@ -1,3 +1,6 @@ +using JetBrains.Annotations; + namespace UnitTests.Graph; +[UsedImplicitly(ImplicitUseKindFlags.InstantiatedNoFixedConstructorSignature)] internal sealed class Implementation : IGenericInterface; diff --git a/test/UnitTests/Graph/TypeLocatorTests.cs b/test/UnitTests/Graph/TypeLocatorTests.cs index 19699b69f..b5023e87b 100644 --- a/test/UnitTests/Graph/TypeLocatorTests.cs +++ b/test/UnitTests/Graph/TypeLocatorTests.cs @@ -23,8 +23,8 @@ public void GetContainerRegistrationFromAssembly_Gets_Implementation() // Assert result.ShouldNotBeNull(); - result.Value.implementationType.Should().Be(typeof(Implementation)); - result.Value.serviceInterface.Should().Be(typeof(IGenericInterface)); + result.Value.implementationType.Should().Be(); + result.Value.serviceInterface.Should().Be>(); } [Fact] @@ -39,7 +39,7 @@ public void GetIdType_Correctly_Identifies_JsonApiResource() Type? idType = typeLocator.LookupIdType(type); // Assert - idType.Should().Be(typeof(int)); + idType.Should().Be(); } [Fact] @@ -71,7 +71,7 @@ public void ResolveResourceDescriptor_Returns_Type_If_Type_Is_IIdentifiable() // Assert descriptor.ShouldNotBeNull(); descriptor.ResourceClrType.Should().Be(resourceClrType); - descriptor.IdClrType.Should().Be(typeof(int)); + descriptor.IdClrType.Should().Be(); } [Fact] diff --git a/tests.runsettings b/tests.runsettings index a41f22cbc..e6790c935 100644 --- a/tests.runsettings +++ b/tests.runsettings @@ -1,7 +1,6 @@ - aggressive true