diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index fa75ada021..60cd78544c 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -3,13 +3,13 @@ "isRoot": true, "tools": { "jetbrains.resharper.globaltools": { - "version": "2020.3.3", + "version": "2021.1.3", "commands": [ "jb" ] }, "regitlint": { - "version": "2.1.3", + "version": "2.1.4", "commands": [ "regitlint" ] @@ -21,7 +21,7 @@ ] }, "dotnet-reportgenerator-globaltool": { - "version": "4.8.7", + "version": "4.8.9", "commands": [ "reportgenerator" ] diff --git a/Directory.Build.props b/Directory.Build.props index 6866b1765f..49eb522e60 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -8,7 +8,7 @@ - + @@ -25,6 +25,7 @@ 3.0.3 5.10.3 4.16.1 - 2.4.1 + 2.4.* + 16.10.0 diff --git a/benchmarks/Benchmarks.csproj b/benchmarks/Benchmarks.csproj index 31ddcf4eaa..4b19516001 100644 --- a/benchmarks/Benchmarks.csproj +++ b/benchmarks/Benchmarks.csproj @@ -9,7 +9,7 @@ - + diff --git a/benchmarks/Serialization/JsonApiDeserializerBenchmarks.cs b/benchmarks/Serialization/JsonApiDeserializerBenchmarks.cs index 963c59cbcc..f4dbd5a829 100644 --- a/benchmarks/Serialization/JsonApiDeserializerBenchmarks.cs +++ b/benchmarks/Serialization/JsonApiDeserializerBenchmarks.cs @@ -36,9 +36,14 @@ public JsonApiDeserializerBenchmarks() { var options = new JsonApiOptions(); IResourceGraph resourceGraph = _dependencyFactory.CreateResourceGraph(options); + + var serviceContainer = new ServiceContainer(); + serviceContainer.AddService(typeof(IResourceDefinitionAccessor), new ResourceDefinitionAccessor(resourceGraph, serviceContainer)); + serviceContainer.AddService(typeof(IResourceDefinition), new JsonApiResourceDefinition(resourceGraph)); + var targetedFields = new TargetedFields(); var request = new JsonApiRequest(); - var resourceFactory = new ResourceFactory(new ServiceContainer()); + var resourceFactory = new ResourceFactory(serviceContainer); var httpContextAccessor = new HttpContextAccessor(); _jsonApiDeserializer = new RequestDeserializer(resourceGraph, resourceFactory, targetedFields, httpContextAccessor, request, options); diff --git a/src/Examples/NoEntityFrameworkExample/NoEntityFrameworkExample.csproj b/src/Examples/NoEntityFrameworkExample/NoEntityFrameworkExample.csproj index 2d007b6362..f7c5aa19ec 100644 --- a/src/Examples/NoEntityFrameworkExample/NoEntityFrameworkExample.csproj +++ b/src/Examples/NoEntityFrameworkExample/NoEntityFrameworkExample.csproj @@ -8,7 +8,7 @@ - + diff --git a/src/JsonApiDotNetCore/JsonApiDotNetCore.csproj b/src/JsonApiDotNetCore/JsonApiDotNetCore.csproj index 081451a7a5..8021a03037 100644 --- a/src/JsonApiDotNetCore/JsonApiDotNetCore.csproj +++ b/src/JsonApiDotNetCore/JsonApiDotNetCore.csproj @@ -21,13 +21,13 @@ - - + + - - + + diff --git a/test/DiscoveryTests/DiscoveryTests.csproj b/test/DiscoveryTests/DiscoveryTests.csproj index eeab7c1b6f..d9c503c784 100644 --- a/test/DiscoveryTests/DiscoveryTests.csproj +++ b/test/DiscoveryTests/DiscoveryTests.csproj @@ -16,7 +16,7 @@ + - \ No newline at end of file diff --git a/test/JsonApiDotNetCoreExampleTests/IntegrationTests/ResourceHooks/ResourceHookTests.cs b/test/JsonApiDotNetCoreExampleTests/IntegrationTests/ResourceHooks/ResourceHookTests.cs index 610d5d279f..2e7ef5129a 100644 --- a/test/JsonApiDotNetCoreExampleTests/IntegrationTests/ResourceHooks/ResourceHookTests.cs +++ b/test/JsonApiDotNetCoreExampleTests/IntegrationTests/ResourceHooks/ResourceHookTests.cs @@ -77,7 +77,8 @@ public async Task Can_create_user_with_password() User responseUser = GetResponseDeserializer().DeserializeSingle(responseDocument).Data; var document = JsonConvert.DeserializeObject(responseDocument); - document.SingleData.Attributes.Should().NotContainKey("password"); + document.Should().NotBeNull(); + document!.SingleData.Attributes.Should().NotContainKey("password"); document.SingleData.Attributes["userName"].Should().Be(newUser.UserName); await _testContext.RunOnDatabaseAsync(async dbContext => diff --git a/test/JsonApiDotNetCoreExampleTests/IntegrationTests/Serialization/SerializationTests.cs b/test/JsonApiDotNetCoreExampleTests/IntegrationTests/Serialization/SerializationTests.cs index ec8198646d..1d3d3bbf7c 100644 --- a/test/JsonApiDotNetCoreExampleTests/IntegrationTests/Serialization/SerializationTests.cs +++ b/test/JsonApiDotNetCoreExampleTests/IntegrationTests/Serialization/SerializationTests.cs @@ -283,7 +283,9 @@ public async Task Cannot_get_unknown_primary_resource_by_ID() httpResponse.Should().HaveStatusCode(HttpStatusCode.NotFound); var jObject = JsonConvert.DeserializeObject(responseDocument); - string errorId = jObject["errors"].Should().NotBeNull().And.Subject.Select(element => (string)element["id"]).Single(); + jObject.Should().NotBeNull(); + + string errorId = jObject!["errors"].Should().NotBeNull().And.Subject.Select(element => (string)element["id"]).Single(); responseDocument.Should().BeJson(@"{ ""errors"": [ diff --git a/test/JsonApiDotNetCoreExampleTests/JsonApiDotNetCoreExampleTests.csproj b/test/JsonApiDotNetCoreExampleTests/JsonApiDotNetCoreExampleTests.csproj index ca068ac1c7..c670e2b662 100644 --- a/test/JsonApiDotNetCoreExampleTests/JsonApiDotNetCoreExampleTests.csproj +++ b/test/JsonApiDotNetCoreExampleTests/JsonApiDotNetCoreExampleTests.csproj @@ -17,6 +17,6 @@ - + diff --git a/test/MultiDbContextTests/MultiDbContextTests.csproj b/test/MultiDbContextTests/MultiDbContextTests.csproj index a20f154918..9631607273 100644 --- a/test/MultiDbContextTests/MultiDbContextTests.csproj +++ b/test/MultiDbContextTests/MultiDbContextTests.csproj @@ -17,7 +17,7 @@ + - diff --git a/test/NoEntityFrameworkTests/NoEntityFrameworkTests.csproj b/test/NoEntityFrameworkTests/NoEntityFrameworkTests.csproj index 0b68188129..7f9fab09ac 100644 --- a/test/NoEntityFrameworkTests/NoEntityFrameworkTests.csproj +++ b/test/NoEntityFrameworkTests/NoEntityFrameworkTests.csproj @@ -11,7 +11,7 @@ + - diff --git a/test/TestBuildingBlocks/DummyTest.cs b/test/TestBuildingBlocks/DummyTest.cs new file mode 100644 index 0000000000..82313a7f29 --- /dev/null +++ b/test/TestBuildingBlocks/DummyTest.cs @@ -0,0 +1,14 @@ +using Xunit; + +namespace TestBuildingBlocks +{ + public sealed class DummyTest + { + [Fact] + public void Empty() + { + // This dummy test exists solely to suppress the warning + // during test runs that no tests were found in this project. + } + } +} diff --git a/test/TestBuildingBlocks/HttpResponseMessageExtensions.cs b/test/TestBuildingBlocks/HttpResponseMessageExtensions.cs index 11352a0f11..3edc655e80 100644 --- a/test/TestBuildingBlocks/HttpResponseMessageExtensions.cs +++ b/test/TestBuildingBlocks/HttpResponseMessageExtensions.cs @@ -47,7 +47,7 @@ private static async Task GetFormattedContentAsync(HttpResponseMessage r { if (text.Length > 0) { - return JsonConvert.DeserializeObject(text).ToString(); + return JsonConvert.DeserializeObject(text)?.ToString(); } } #pragma warning disable AV1210 // Catch a specific exception instead of Exception, SystemException or ApplicationException diff --git a/test/TestBuildingBlocks/TestBuildingBlocks.csproj b/test/TestBuildingBlocks/TestBuildingBlocks.csproj index 3aa8cb646a..a4eae45836 100644 --- a/test/TestBuildingBlocks/TestBuildingBlocks.csproj +++ b/test/TestBuildingBlocks/TestBuildingBlocks.csproj @@ -13,8 +13,9 @@ - + + diff --git a/test/UnitTests/UnitTests.csproj b/test/UnitTests/UnitTests.csproj index 8b8cb5daf4..5c395abb89 100644 --- a/test/UnitTests/UnitTests.csproj +++ b/test/UnitTests/UnitTests.csproj @@ -18,7 +18,7 @@ + -