diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 1dc9384515..18cc059d46 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -47,7 +47,10 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
- dotnet-version: 6.0.x
+ dotnet-version: |
+ 6.0.x
+ 8.0.x
+ dotnet-quality: 'preview'
- name: Setup PowerShell (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: |
@@ -178,7 +181,10 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
- dotnet-version: 6.0.x
+ dotnet-version: |
+ 6.0.x
+ 8.0.x
+ dotnet-quality: 'preview'
- name: Git checkout
uses: actions/checkout@v4
- name: Restore tools
@@ -189,7 +195,7 @@ jobs:
run: |
$inspectCodeOutputPath = Join-Path $env:RUNNER_TEMP 'jetbrains-inspectcode-results.xml'
Write-Output "INSPECT_CODE_OUTPUT_PATH=$inspectCodeOutputPath" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- dotnet jb inspectcode JsonApiDotNetCore.sln --build --output="$inspectCodeOutputPath" --profile=WarningSeverities.DotSettings --properties:Configuration=Release --properties:ContinuousIntegrationBuild=false --severity=WARNING --verbosity=WARN -dsl=GlobalAll -dsl=GlobalPerProduct -dsl=SolutionPersonal -dsl=ProjectPersonal
+ dotnet jb inspectcode JsonApiDotNetCore.sln --build --dotnetcoresdk=$(dotnet --version) --output="$inspectCodeOutputPath" --profile=WarningSeverities.DotSettings --properties:Configuration=Release --properties:ContinuousIntegrationBuild=false --severity=WARNING --verbosity=WARN -dsl=GlobalAll -dsl=GlobalPerProduct -dsl=SolutionPersonal -dsl=ProjectPersonal
- name: Verify outcome
shell: pwsh
run: |
@@ -229,7 +235,10 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
- dotnet-version: 6.0.x
+ dotnet-version: |
+ 6.0.x
+ 8.0.x
+ dotnet-quality: 'preview'
- name: Git checkout
uses: actions/checkout@v4
with:
@@ -250,13 +259,13 @@ jobs:
$baseCommitHash = git rev-parse HEAD~1
Write-Output "Running code cleanup on commit range $baseCommitHash..$headCommitHash in pull request."
- dotnet regitlint -s JsonApiDotNetCore.sln --print-command --skip-tool-check --max-runs=5 --jb-profile="JADNC Full Cleanup" --jb --properties:Configuration=Release --jb --verbosity=WARN -f commits -a $headCommitHash -b $baseCommitHash --fail-on-diff --print-diff
+ dotnet regitlint -s JsonApiDotNetCore.sln --print-command --skip-tool-check --max-runs=5 --jb --dotnetcoresdk=$(dotnet --version) --jb-profile="JADNC Full Cleanup" --jb --properties:Configuration=Release --jb --verbosity=WARN -f commits -a $headCommitHash -b $baseCommitHash --fail-on-diff --print-diff
- name: CleanupCode (on branch)
if: github.event_name == 'push' || github.event_name == 'release'
shell: pwsh
run: |
Write-Output "Running code cleanup on all files."
- dotnet regitlint -s JsonApiDotNetCore.sln --print-command --skip-tool-check --jb-profile="JADNC Full Cleanup" --jb --properties:Configuration=Release --jb --verbosity=WARN --fail-on-diff --print-diff
+ dotnet regitlint -s JsonApiDotNetCore.sln --print-command --skip-tool-check --jb --dotnetcoresdk=$(dotnet --version)--jb-profile="JADNC Full Cleanup" --jb --properties:Configuration=Release --jb --verbosity=WARN --fail-on-diff --print-diff
publish:
timeout-minutes: 60
diff --git a/Directory.Build.props b/Directory.Build.props
index 75d754d5bc..2f32fa082f 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -13,42 +13,21 @@
true
+
-
- net6.0
- 4.1.0
- 0.4.1
- 6.0.0
- 2.14.1
-
-
- 6.0.*
- 0.13.*
- 34.0.*
- 3.8.*
- 4.7.*
- 6.0.*
- 2.1.*
- 7.0.*
- 6.12.*
- 2.3.*
- 1.3.*
- 2023.2.*
- 7.0.*
- 1.1.*
- 7.0.*
- 17.7.*
- 2.5.*
+ $(NoWarn);NU5104
+ true
-
-
+
+
enable
+ latest
enable
false
false
diff --git a/JsonApiDotNetCore.sln b/JsonApiDotNetCore.sln
index 2f8e9f9127..0d31e50013 100644
--- a/JsonApiDotNetCore.sln
+++ b/JsonApiDotNetCore.sln
@@ -13,6 +13,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
CodingGuidelines.ruleset = CodingGuidelines.ruleset
CSharpGuidelinesAnalyzer.config = CSharpGuidelinesAnalyzer.config
Directory.Build.props = Directory.Build.props
+ package-versions.props = package-versions.props
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Examples", "Examples", "{026FBC6C-AF76-4568-9B87-EC73457899FD}"
diff --git a/benchmarks/Benchmarks.csproj b/benchmarks/Benchmarks.csproj
index 1e97dd290f..9dbb9ba093 100644
--- a/benchmarks/Benchmarks.csproj
+++ b/benchmarks/Benchmarks.csproj
@@ -1,10 +1,12 @@
Exe
- $(TargetFrameworkName)
+ net8.0
true
+
+
diff --git a/cleanupcode.ps1 b/cleanupcode.ps1
index ba1b0ca4c0..3ab4d620ae 100644
--- a/cleanupcode.ps1
+++ b/cleanupcode.ps1
@@ -28,17 +28,17 @@ if ($revision) {
if ($baseCommitHash -eq $headCommitHash) {
Write-Output "Running code cleanup on staged/unstaged files."
- dotnet regitlint -s JsonApiDotNetCore.sln --print-command --skip-tool-check --max-runs=5 --jb-profile="JADNC Full Cleanup" --jb --properties:Configuration=Release --jb --verbosity=WARN -f staged,modified
+ dotnet regitlint -s JsonApiDotNetCore.sln --print-command --skip-tool-check --max-runs=5 --jb --dotnetcoresdk=$(dotnet --version) --jb-profile="JADNC Full Cleanup" --jb --properties:Configuration=Release --jb --verbosity=WARN -f staged,modified
VerifySuccessExitCode
}
else {
Write-Output "Running code cleanup on commit range $baseCommitHash..$headCommitHash, including staged/unstaged files."
- dotnet regitlint -s JsonApiDotNetCore.sln --print-command --skip-tool-check --max-runs=5 --jb-profile="JADNC Full Cleanup" --jb --properties:Configuration=Release --jb --verbosity=WARN -f staged,modified,commits -a $headCommitHash -b $baseCommitHash
+ dotnet regitlint -s JsonApiDotNetCore.sln --print-command --skip-tool-check --max-runs=5 --jb --dotnetcoresdk=$(dotnet --version) --jb-profile="JADNC Full Cleanup" --jb --properties:Configuration=Release --jb --verbosity=WARN -f staged,modified,commits -a $headCommitHash -b $baseCommitHash
VerifySuccessExitCode
}
}
else {
Write-Output "Running code cleanup on all files."
- dotnet regitlint -s JsonApiDotNetCore.sln --print-command --skip-tool-check --jb-profile="JADNC Full Cleanup" --jb --properties:Configuration=Release --jb --verbosity=WARN
+ dotnet regitlint -s JsonApiDotNetCore.sln --print-command --skip-tool-check --jb --dotnetcoresdk=$(dotnet --version) --jb-profile="JADNC Full Cleanup" --jb --properties:Configuration=Release --jb --verbosity=WARN
VerifySuccessExitCode
}
diff --git a/inspectcode.ps1 b/inspectcode.ps1
index b379bce1c6..14c3eb1736 100644
--- a/inspectcode.ps1
+++ b/inspectcode.ps1
@@ -10,7 +10,7 @@ if ($LastExitCode -ne 0) {
$outputPath = [System.IO.Path]::Combine([System.IO.Path]::GetTempPath(), 'jetbrains-inspectcode-results.xml')
$resultPath = [System.IO.Path]::Combine([System.IO.Path]::GetTempPath(), 'jetbrains-inspectcode-results.html')
-dotnet jb inspectcode JsonApiDotNetCore.sln --build --output="$outputPath" --profile=WarningSeverities.DotSettings --properties:Configuration=Release --severity=WARNING --verbosity=WARN -dsl=GlobalAll -dsl=GlobalPerProduct -dsl=SolutionPersonal -dsl=ProjectPersonal
+dotnet jb inspectcode JsonApiDotNetCore.sln --dotnetcoresdk=$(dotnet --version) --build --output="$outputPath" --profile=WarningSeverities.DotSettings --properties:Configuration=Release --severity=WARNING --verbosity=WARN -dsl=GlobalAll -dsl=GlobalPerProduct -dsl=SolutionPersonal -dsl=ProjectPersonal
if ($LastExitCode -ne 0) {
throw "Code inspection failed with exit code $LastExitCode"
diff --git a/package-versions.props b/package-versions.props
new file mode 100644
index 0000000000..89209daeaa
--- /dev/null
+++ b/package-versions.props
@@ -0,0 +1,45 @@
+
+
+
+ 4.1.0
+ 0.4.1
+ 2.14.1
+
+
+ 0.13.*
+ 34.0.*
+ 3.8.*
+ 4.7.*
+ 6.0.*
+ 2.1.*
+ 6.12.*
+ 2.3.*
+ 1.3.*
+ 2023.2.*
+ 1.1.*
+ 17.7.*
+ 2.5.*
+
+
+
+
+ 8.0.0-rc.1.*
+
+
+ 8.0.0-rc.1.*
+ 8.0.0-rc.1.*
+ 8.0.0-rc.1
+ $(AspNetCoreVersion)
+
+
+
+
+ 6.0.0
+
+
+ 6.0.*
+ 7.0.*
+ 7.0.*
+ 7.0.*
+
+
diff --git a/src/Examples/DatabasePerTenantExample/DatabasePerTenantExample.csproj b/src/Examples/DatabasePerTenantExample/DatabasePerTenantExample.csproj
index c219dfd0f5..de908e0046 100644
--- a/src/Examples/DatabasePerTenantExample/DatabasePerTenantExample.csproj
+++ b/src/Examples/DatabasePerTenantExample/DatabasePerTenantExample.csproj
@@ -1,8 +1,10 @@
- $(TargetFrameworkName)
+ net8.0;net6.0
+
+
- $(TargetFrameworkName)
+ net8.0;net6.0
+
+
{
- private readonly ISystemClock _systemClock;
+ private readonly Func _getUtcNow;
+#if NET6_0
public TodoItemDefinition(IResourceGraph resourceGraph, ISystemClock systemClock)
: base(resourceGraph)
{
- _systemClock = systemClock;
+ _getUtcNow = () => systemClock.UtcNow;
}
+#else
+ public TodoItemDefinition(IResourceGraph resourceGraph, TimeProvider timeProvider)
+ : base(resourceGraph)
+ {
+ _getUtcNow = timeProvider.GetUtcNow;
+ }
+#endif
public override SortExpression OnApplySort(SortExpression? existingSort)
{
@@ -38,11 +48,11 @@ public override Task OnWritingAsync(TodoItem resource, WriteOperationKind writeO
{
if (writeOperation == WriteOperationKind.CreateResource)
{
- resource.CreatedAt = _systemClock.UtcNow;
+ resource.CreatedAt = _getUtcNow();
}
else if (writeOperation == WriteOperationKind.UpdateResource)
{
- resource.LastModifiedAt = _systemClock.UtcNow;
+ resource.LastModifiedAt = _getUtcNow();
}
return Task.CompletedTask;
diff --git a/src/Examples/JsonApiDotNetCoreExample/JsonApiDotNetCoreExample.csproj b/src/Examples/JsonApiDotNetCoreExample/JsonApiDotNetCoreExample.csproj
index c219dfd0f5..de908e0046 100644
--- a/src/Examples/JsonApiDotNetCoreExample/JsonApiDotNetCoreExample.csproj
+++ b/src/Examples/JsonApiDotNetCoreExample/JsonApiDotNetCoreExample.csproj
@@ -1,8 +1,10 @@
- $(TargetFrameworkName)
+ net8.0;net6.0
+
+
();
+#else
+ builder.Services.TryAddSingleton(TimeProvider.System);
+#endif
builder.Services.AddDbContext(options =>
{
diff --git a/src/Examples/MultiDbContextExample/MultiDbContextExample.csproj b/src/Examples/MultiDbContextExample/MultiDbContextExample.csproj
index 9e0c80b7f4..1f4645f323 100644
--- a/src/Examples/MultiDbContextExample/MultiDbContextExample.csproj
+++ b/src/Examples/MultiDbContextExample/MultiDbContextExample.csproj
@@ -1,8 +1,10 @@
- $(TargetFrameworkName)
+ net8.0;net6.0
+
+
- $(TargetFrameworkName)
+ net8.0;net6.0
+
+
- $(TargetFrameworkName)
+ net8.0;net6.0
+
+
- $(TargetFrameworkName);netstandard1.0
+ net8.0;net6.0;netstandard1.0
true
true
JsonApiDotNetCore
- latest
+
+
$(JsonApiDotNetCoreVersionPrefix)
jsonapidotnetcore;jsonapi;json:api;dotnet;asp.net;rest;web-api
diff --git a/src/JsonApiDotNetCore.SourceGenerators/JsonApiDotNetCore.SourceGenerators.csproj b/src/JsonApiDotNetCore.SourceGenerators/JsonApiDotNetCore.SourceGenerators.csproj
index ca6de1a5b7..f784ada6f9 100644
--- a/src/JsonApiDotNetCore.SourceGenerators/JsonApiDotNetCore.SourceGenerators.csproj
+++ b/src/JsonApiDotNetCore.SourceGenerators/JsonApiDotNetCore.SourceGenerators.csproj
@@ -5,10 +5,11 @@
true
false
$(NoWarn);NU5128
- latest
true
+
+
$(JsonApiDotNetCoreVersionPrefix)
jsonapidotnetcore;jsonapi;json:api;dotnet;asp.net;rest;web-api
diff --git a/src/JsonApiDotNetCore/JsonApiDotNetCore.csproj b/src/JsonApiDotNetCore/JsonApiDotNetCore.csproj
index 4407edaf1f..1757b54a82 100644
--- a/src/JsonApiDotNetCore/JsonApiDotNetCore.csproj
+++ b/src/JsonApiDotNetCore/JsonApiDotNetCore.csproj
@@ -1,10 +1,12 @@
- $(TargetFrameworkName)
+ net8.0;net6.0
true
true
+
+
$(JsonApiDotNetCoreVersionPrefix)
jsonapidotnetcore;jsonapi;json:api;dotnet;asp.net;rest;web-api
diff --git a/src/JsonApiDotNetCore/Serialization/Response/FingerprintGenerator.cs b/src/JsonApiDotNetCore/Serialization/Response/FingerprintGenerator.cs
index e0b3e56b10..3ecc0b2c5a 100644
--- a/src/JsonApiDotNetCore/Serialization/Response/FingerprintGenerator.cs
+++ b/src/JsonApiDotNetCore/Serialization/Response/FingerprintGenerator.cs
@@ -6,7 +6,11 @@ namespace JsonApiDotNetCore.Serialization.Response;
///
internal sealed class FingerprintGenerator : IFingerprintGenerator
{
+#if NET6_0
private static readonly byte[] Separator = Encoding.UTF8.GetBytes("|");
+#else
+ private static readonly byte[] Separator = "|"u8.ToArray();
+#endif
private static readonly uint[] LookupTable = Enumerable.Range(0, 256).Select(ToLookupEntry).ToArray();
private static uint ToLookupEntry(int index)
diff --git a/test/AnnotationTests/AnnotationTests.csproj b/test/AnnotationTests/AnnotationTests.csproj
index b712b1bb67..081046adb0 100644
--- a/test/AnnotationTests/AnnotationTests.csproj
+++ b/test/AnnotationTests/AnnotationTests.csproj
@@ -1,9 +1,10 @@
- $(TargetFrameworkName);netstandard2.0
- latest
+ net8.0;net6.0;netstandard2.0
+
+
diff --git a/test/DiscoveryTests/DiscoveryTests.csproj b/test/DiscoveryTests/DiscoveryTests.csproj
index a09e322203..a64d3be689 100644
--- a/test/DiscoveryTests/DiscoveryTests.csproj
+++ b/test/DiscoveryTests/DiscoveryTests.csproj
@@ -1,8 +1,10 @@
- $(TargetFrameworkName)
+ net8.0;net6.0
+
+
diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Creating/AtomicCreateResourceTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Creating/AtomicCreateResourceTests.cs
index 3331b1f1cc..9b91727470 100644
--- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Creating/AtomicCreateResourceTests.cs
+++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Creating/AtomicCreateResourceTests.cs
@@ -3,7 +3,6 @@
using FluentAssertions.Extensions;
using JsonApiDotNetCore.Configuration;
using JsonApiDotNetCore.Serialization.Objects;
-using Microsoft.AspNetCore.Authentication;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using TestBuildingBlocks;
diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Creating/AtomicCreateResourceWithClientGeneratedIdTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Creating/AtomicCreateResourceWithClientGeneratedIdTests.cs
index 15dbc19b07..551fa222f0 100644
--- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Creating/AtomicCreateResourceWithClientGeneratedIdTests.cs
+++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Creating/AtomicCreateResourceWithClientGeneratedIdTests.cs
@@ -2,7 +2,6 @@
using FluentAssertions;
using JsonApiDotNetCore.Configuration;
using JsonApiDotNetCore.Serialization.Objects;
-using Microsoft.AspNetCore.Authentication;
using Microsoft.Extensions.DependencyInjection;
using TestBuildingBlocks;
using Xunit;
diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/DateMustBeInThePastAttribute.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/DateMustBeInThePastAttribute.cs
index 0421f2e396..b273eca898 100644
--- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/DateMustBeInThePastAttribute.cs
+++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/DateMustBeInThePastAttribute.cs
@@ -1,8 +1,8 @@
using System.ComponentModel.DataAnnotations;
using System.Reflection;
using JsonApiDotNetCore.Resources;
-using Microsoft.AspNetCore.Authentication;
using Microsoft.Extensions.DependencyInjection;
+using TestBuildingBlocks;
namespace JsonApiDotNetCoreTests.IntegrationTests.AtomicOperations;
diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Meta/AtomicResourceMetaTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Meta/AtomicResourceMetaTests.cs
index 2bd9dc8edf..027c611cdc 100644
--- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Meta/AtomicResourceMetaTests.cs
+++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Meta/AtomicResourceMetaTests.cs
@@ -4,7 +4,6 @@
using FluentAssertions.Extensions;
using JsonApiDotNetCore.Configuration;
using JsonApiDotNetCore.Serialization.Objects;
-using Microsoft.AspNetCore.Authentication;
using Microsoft.Extensions.DependencyInjection;
using TestBuildingBlocks;
using Xunit;
diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/ModelStateValidation/AtomicModelStateValidationTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/ModelStateValidation/AtomicModelStateValidationTests.cs
index 03a04fb431..d57dca409c 100644
--- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/ModelStateValidation/AtomicModelStateValidationTests.cs
+++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/ModelStateValidation/AtomicModelStateValidationTests.cs
@@ -1,7 +1,6 @@
using System.Net;
using FluentAssertions;
using JsonApiDotNetCore.Serialization.Objects;
-using Microsoft.AspNetCore.Authentication;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using TestBuildingBlocks;
diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/QueryStrings/AtomicQueryStringTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/QueryStrings/AtomicQueryStringTests.cs
index 392a76c08d..02b2e68f83 100644
--- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/QueryStrings/AtomicQueryStringTests.cs
+++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/QueryStrings/AtomicQueryStringTests.cs
@@ -2,7 +2,6 @@
using FluentAssertions;
using JsonApiDotNetCore.Configuration;
using JsonApiDotNetCore.Serialization.Objects;
-using Microsoft.AspNetCore.Authentication;
using Microsoft.Extensions.DependencyInjection;
using TestBuildingBlocks;
using Xunit;
diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/QueryStrings/MusicTrackReleaseDefinition.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/QueryStrings/MusicTrackReleaseDefinition.cs
index 65ab4a4344..84827322ad 100644
--- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/QueryStrings/MusicTrackReleaseDefinition.cs
+++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/QueryStrings/MusicTrackReleaseDefinition.cs
@@ -2,8 +2,8 @@
using JsonApiDotNetCore;
using JsonApiDotNetCore.Configuration;
using JsonApiDotNetCore.Resources;
-using Microsoft.AspNetCore.Authentication;
using Microsoft.Extensions.Primitives;
+using TestBuildingBlocks;
namespace JsonApiDotNetCoreTests.IntegrationTests.AtomicOperations.QueryStrings;
diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Resources/AtomicUpdateResourceTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Resources/AtomicUpdateResourceTests.cs
index 895d1a0df5..f6a4411777 100644
--- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Resources/AtomicUpdateResourceTests.cs
+++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Resources/AtomicUpdateResourceTests.cs
@@ -3,7 +3,6 @@
using FluentAssertions.Extensions;
using JsonApiDotNetCore.Configuration;
using JsonApiDotNetCore.Serialization.Objects;
-using Microsoft.AspNetCore.Authentication;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using TestBuildingBlocks;
diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/CustomRoutes/ApiControllerAttributeTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/CustomRoutes/ApiControllerAttributeTests.cs
index 28e6ba2439..a27ef77329 100644
--- a/test/JsonApiDotNetCoreTests/IntegrationTests/CustomRoutes/ApiControllerAttributeTests.cs
+++ b/test/JsonApiDotNetCoreTests/IntegrationTests/CustomRoutes/ApiControllerAttributeTests.cs
@@ -33,7 +33,7 @@ public async Task ApiController_attribute_transforms_NotFound_action_result_with
ErrorObject error = responseDocument.Errors[0];
error.Links.ShouldNotBeNull();
- error.Links.About.Should().Be("https://tools.ietf.org/html/rfc7231#section-6.5.4");
+ error.Links.About.Should().StartWith("https://tools.ietf.org/html/rfc");
}
[Fact]
@@ -66,7 +66,7 @@ public async Task ProblemDetails_from_invalid_ModelState_is_translated_into_erro
ErrorObject error1 = responseDocument.Errors[0];
error1.StatusCode.Should().Be(HttpStatusCode.BadRequest);
error1.Links.ShouldNotBeNull();
- error1.Links.About.Should().Be("https://tools.ietf.org/html/rfc7231#section-6.5.1");
+ error1.Links.About.Should().StartWith("https://tools.ietf.org/html/rfc");
error1.Title.Should().Be("One or more validation errors occurred.");
error1.Detail.Should().Be("The Name field is required.");
error1.Source.Should().BeNull();
@@ -74,7 +74,7 @@ public async Task ProblemDetails_from_invalid_ModelState_is_translated_into_erro
ErrorObject error2 = responseDocument.Errors[1];
error2.StatusCode.Should().Be(HttpStatusCode.BadRequest);
error2.Links.ShouldNotBeNull();
- error2.Links.About.Should().Be("https://tools.ietf.org/html/rfc7231#section-6.5.1");
+ error2.Links.About.Should().StartWith("https://tools.ietf.org/html/rfc");
error2.Title.Should().Be("One or more validation errors occurred.");
error2.Detail.Should().Be("The field YearOfBirth must be between 1900 and 2050.");
error2.Source.Should().BeNull();
diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/CustomFunctions/TimeOffset/FilterRewritingResourceDefinition.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/CustomFunctions/TimeOffset/FilterRewritingResourceDefinition.cs
index 138ccdeafd..c3e5941a19 100644
--- a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/CustomFunctions/TimeOffset/FilterRewritingResourceDefinition.cs
+++ b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/CustomFunctions/TimeOffset/FilterRewritingResourceDefinition.cs
@@ -2,7 +2,7 @@
using JsonApiDotNetCore.Configuration;
using JsonApiDotNetCore.Queries.Expressions;
using JsonApiDotNetCore.Resources;
-using Microsoft.AspNetCore.Authentication;
+using TestBuildingBlocks;
namespace JsonApiDotNetCoreTests.IntegrationTests.QueryStrings.CustomFunctions.TimeOffset;
diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/CustomFunctions/TimeOffset/FilterTimeOffsetRewriter.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/CustomFunctions/TimeOffset/FilterTimeOffsetRewriter.cs
index 8adc07fdf0..2d2ee4da89 100644
--- a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/CustomFunctions/TimeOffset/FilterTimeOffsetRewriter.cs
+++ b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/CustomFunctions/TimeOffset/FilterTimeOffsetRewriter.cs
@@ -1,5 +1,5 @@
using JsonApiDotNetCore.Queries.Expressions;
-using Microsoft.AspNetCore.Authentication;
+using TestBuildingBlocks;
namespace JsonApiDotNetCoreTests.IntegrationTests.QueryStrings.CustomFunctions.TimeOffset;
diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/CustomFunctions/TimeOffset/TimeOffsetTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/CustomFunctions/TimeOffset/TimeOffsetTests.cs
index 3a171bdae0..dfbc291483 100644
--- a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/CustomFunctions/TimeOffset/TimeOffsetTests.cs
+++ b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/CustomFunctions/TimeOffset/TimeOffsetTests.cs
@@ -6,7 +6,6 @@
using JsonApiDotNetCore.Queries.Parsing;
using JsonApiDotNetCore.Resources;
using JsonApiDotNetCore.Serialization.Objects;
-using Microsoft.AspNetCore.Authentication;
using Microsoft.Extensions.DependencyInjection;
using TestBuildingBlocks;
using Xunit;
diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceConstructorInjection/GiftCertificate.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceConstructorInjection/GiftCertificate.cs
index 2cd1ff91d8..6da63a30cb 100644
--- a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceConstructorInjection/GiftCertificate.cs
+++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceConstructorInjection/GiftCertificate.cs
@@ -2,7 +2,7 @@
using JetBrains.Annotations;
using JsonApiDotNetCore.Resources;
using JsonApiDotNetCore.Resources.Annotations;
-using Microsoft.AspNetCore.Authentication;
+using TestBuildingBlocks;
namespace JsonApiDotNetCoreTests.IntegrationTests.ResourceConstructorInjection;
diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceConstructorInjection/InjectionDbContext.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceConstructorInjection/InjectionDbContext.cs
index bb3bbfd85b..57ec534cae 100644
--- a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceConstructorInjection/InjectionDbContext.cs
+++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceConstructorInjection/InjectionDbContext.cs
@@ -1,6 +1,5 @@
using JetBrains.Annotations;
using JsonApiDotNetCore;
-using Microsoft.AspNetCore.Authentication;
using Microsoft.EntityFrameworkCore;
using TestBuildingBlocks;
diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceConstructorInjection/PostOffice.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceConstructorInjection/PostOffice.cs
index da163d9cee..f7bd504cd8 100644
--- a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceConstructorInjection/PostOffice.cs
+++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceConstructorInjection/PostOffice.cs
@@ -2,7 +2,7 @@
using JetBrains.Annotations;
using JsonApiDotNetCore.Resources;
using JsonApiDotNetCore.Resources.Annotations;
-using Microsoft.AspNetCore.Authentication;
+using TestBuildingBlocks;
namespace JsonApiDotNetCoreTests.IntegrationTests.ResourceConstructorInjection;
diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceConstructorInjection/ResourceInjectionTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceConstructorInjection/ResourceInjectionTests.cs
index 19b38cf071..e1b589c7a4 100644
--- a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceConstructorInjection/ResourceInjectionTests.cs
+++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceConstructorInjection/ResourceInjectionTests.cs
@@ -2,7 +2,6 @@
using FluentAssertions;
using FluentAssertions.Extensions;
using JsonApiDotNetCore.Serialization.Objects;
-using Microsoft.AspNetCore.Authentication;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using TestBuildingBlocks;
diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/SoftDeletion/SoftDeletionAwareResourceService.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/SoftDeletion/SoftDeletionAwareResourceService.cs
index 299a40bad8..2b6e3be294 100644
--- a/test/JsonApiDotNetCoreTests/IntegrationTests/SoftDeletion/SoftDeletionAwareResourceService.cs
+++ b/test/JsonApiDotNetCoreTests/IntegrationTests/SoftDeletion/SoftDeletionAwareResourceService.cs
@@ -5,8 +5,8 @@
using JsonApiDotNetCore.Repositories;
using JsonApiDotNetCore.Resources;
using JsonApiDotNetCore.Services;
-using Microsoft.AspNetCore.Authentication;
using Microsoft.Extensions.Logging;
+using TestBuildingBlocks;
namespace JsonApiDotNetCoreTests.IntegrationTests.SoftDeletion;
diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/SoftDeletion/SoftDeletionTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/SoftDeletion/SoftDeletionTests.cs
index 63ae9689a0..fba38f38a1 100644
--- a/test/JsonApiDotNetCoreTests/IntegrationTests/SoftDeletion/SoftDeletionTests.cs
+++ b/test/JsonApiDotNetCoreTests/IntegrationTests/SoftDeletion/SoftDeletionTests.cs
@@ -3,7 +3,6 @@
using FluentAssertions.Extensions;
using JsonApiDotNetCore.Configuration;
using JsonApiDotNetCore.Serialization.Objects;
-using Microsoft.AspNetCore.Authentication;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using TestBuildingBlocks;
diff --git a/test/JsonApiDotNetCoreTests/JsonApiDotNetCoreTests.csproj b/test/JsonApiDotNetCoreTests/JsonApiDotNetCoreTests.csproj
index 7a3fa8ddf8..5c2a16e365 100644
--- a/test/JsonApiDotNetCoreTests/JsonApiDotNetCoreTests.csproj
+++ b/test/JsonApiDotNetCoreTests/JsonApiDotNetCoreTests.csproj
@@ -1,8 +1,10 @@
- $(TargetFrameworkName)
+ net8.0;net6.0
+
+
- $(TargetFrameworkName)
+ net8.0;net6.0
+
+
diff --git a/test/NoEntityFrameworkTests/NoEntityFrameworkTests.csproj b/test/NoEntityFrameworkTests/NoEntityFrameworkTests.csproj
index 84a36dcbb1..080666d491 100644
--- a/test/NoEntityFrameworkTests/NoEntityFrameworkTests.csproj
+++ b/test/NoEntityFrameworkTests/NoEntityFrameworkTests.csproj
@@ -1,8 +1,10 @@
- $(TargetFrameworkName)
+ net8.0;net6.0
+
+
diff --git a/test/NoEntityFrameworkTests/NullSafeExpressionRewriterTests.cs b/test/NoEntityFrameworkTests/NullSafeExpressionRewriterTests.cs
index 57da032819..e8fe1585ca 100644
--- a/test/NoEntityFrameworkTests/NullSafeExpressionRewriterTests.cs
+++ b/test/NoEntityFrameworkTests/NullSafeExpressionRewriterTests.cs
@@ -498,7 +498,11 @@ public void Can_rewrite_order_by_clause_with_IntPtr()
Parent = new TestResource
{
Id = generator.GetNext(),
+#if NET6_0
Pointer = (IntPtr)1
+#else
+ Pointer = 1
+#endif
}
}
};
diff --git a/test/SourceGeneratorTests/SourceGeneratorTests.csproj b/test/SourceGeneratorTests/SourceGeneratorTests.csproj
index d361de38e5..e28bdc20d1 100644
--- a/test/SourceGeneratorTests/SourceGeneratorTests.csproj
+++ b/test/SourceGeneratorTests/SourceGeneratorTests.csproj
@@ -1,8 +1,10 @@
- $(TargetFrameworkName)
+ net8.0;net6.0
+
+
diff --git a/test/TestBuildingBlocks/DbContextExtensions.cs b/test/TestBuildingBlocks/DbContextExtensions.cs
index 7f32073874..757ea2491d 100644
--- a/test/TestBuildingBlocks/DbContextExtensions.cs
+++ b/test/TestBuildingBlocks/DbContextExtensions.cs
@@ -44,7 +44,9 @@ private static async Task ClearTablesAsync(this DbContext dbContext, params Type
}
else
{
+#pragma warning disable EF1002 // Risk of vulnerability to SQL injection.
await dbContext.Database.ExecuteSqlRawAsync($"DELETE FROM \"{tableName}\"");
+#pragma warning restore EF1002 // Risk of vulnerability to SQL injection.
}
}
}
diff --git a/test/TestBuildingBlocks/FrozenSystemClock.cs b/test/TestBuildingBlocks/FrozenSystemClock.cs
index a1d85e1fcc..6ffe8feaaf 100644
--- a/test/TestBuildingBlocks/FrozenSystemClock.cs
+++ b/test/TestBuildingBlocks/FrozenSystemClock.cs
@@ -1,5 +1,4 @@
using FluentAssertions.Extensions;
-using Microsoft.AspNetCore.Authentication;
namespace TestBuildingBlocks;
diff --git a/test/TestBuildingBlocks/ISystemClock.cs b/test/TestBuildingBlocks/ISystemClock.cs
new file mode 100644
index 0000000000..eb1c8628a3
--- /dev/null
+++ b/test/TestBuildingBlocks/ISystemClock.cs
@@ -0,0 +1,6 @@
+namespace TestBuildingBlocks;
+
+public interface ISystemClock
+{
+ DateTimeOffset UtcNow { get; }
+}
diff --git a/test/TestBuildingBlocks/TestBuildingBlocks.csproj b/test/TestBuildingBlocks/TestBuildingBlocks.csproj
index ba9a2f5da3..dbe87533d5 100644
--- a/test/TestBuildingBlocks/TestBuildingBlocks.csproj
+++ b/test/TestBuildingBlocks/TestBuildingBlocks.csproj
@@ -1,8 +1,10 @@
- $(TargetFrameworkName)
+ net8.0;net6.0
+
+
diff --git a/test/UnitTests/UnitTests.csproj b/test/UnitTests/UnitTests.csproj
index f8dcbce984..99fc7ce781 100644
--- a/test/UnitTests/UnitTests.csproj
+++ b/test/UnitTests/UnitTests.csproj
@@ -1,8 +1,10 @@
- $(TargetFrameworkName)
+ net8.0;net6.0
+
+