diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 750c0476bc..1881e787dd 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: |
@@ -87,8 +90,13 @@ jobs:
- name: Git checkout
uses: actions/checkout@v4
- name: Restore tools
+ shell: pwsh
run: |
- dotnet tool restore
+ # Temporary workaround for bug in .NET 8 RC2 at https://github.com/dotnet/sdk/issues/35989
+ $tools = Get-Content ".config/dotnet-tools.json" | ConvertFrom-Json
+ foreach ($tool in $tools.tools.PsObject.Properties) {
+ & dotnet tool install $tool.Name --version $tool.Value.version
+ }
- name: Restore packages
run: |
dotnet restore
@@ -181,18 +189,26 @@ 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
+ shell: pwsh
run: |
- dotnet tool restore
+ # Temporary workaround for bug in .NET 8 RC2 at https://github.com/dotnet/sdk/issues/35989
+ $tools = Get-Content ".config/dotnet-tools.json" | ConvertFrom-Json
+ foreach ($tool in $tools.tools.PsObject.Properties) {
+ & dotnet tool install $tool.Name --version $tool.Value.version
+ }
- name: InspectCode
shell: pwsh
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: |
@@ -232,14 +248,22 @@ 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:
fetch-depth: 2
- name: Restore tools
+ shell: pwsh
run: |
- dotnet tool restore
+ # Temporary workaround for bug in .NET 8 RC2 at https://github.com/dotnet/sdk/issues/35989
+ $tools = Get-Content ".config/dotnet-tools.json" | ConvertFrom-Json
+ foreach ($tool in $tools.tools.PsObject.Properties) {
+ & dotnet tool install $tool.Name --version $tool.Value.version
+ }
- name: Restore packages
run: |
dotnet restore
@@ -253,13 +277,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 910b387f01..bad92495c5 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -13,43 +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.*
- 2.1.*
- 7.0.*
- 6.12.*
- 2.3.*
- 1.3.*
- 2023.3.*
- 7.0.*
- 1.1.*
- 7.0.*
- 17.8.*
- 2.5.*
+ $(NoWarn);NU5104
+ true
-
-
+
+
enable
+ latest
enable
false
false
diff --git a/JsonApiDotNetCore.sln b/JsonApiDotNetCore.sln
index 4f8bd6f8ef..e821d4175d 100644
--- a/JsonApiDotNetCore.sln
+++ b/JsonApiDotNetCore.sln
@@ -14,6 +14,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
CSharpGuidelinesAnalyzer.config = CSharpGuidelinesAnalyzer.config
Directory.Build.props = Directory.Build.props
tests.runsettings = tests.runsettings
+ package-versions.props = package-versions.props
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Examples", "Examples", "{026FBC6C-AF76-4568-9B87-EC73457899FD}"
diff --git a/NuGet.config b/NuGet.config
new file mode 100644
index 0000000000..d424527524
--- /dev/null
+++ b/NuGet.config
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/README.md b/README.md
index fe2658711f..0a4b178826 100644
--- a/README.md
+++ b/README.md
@@ -79,14 +79,21 @@ See also our [versioning policy](./VERSIONING_POLICY.md).
| JsonApiDotNetCore | Status | .NET | Entity Framework Core |
| ----------------- | ----------- | -------- | --------------------- |
| 3.x | Stable | Core 2.x | 2.x |
-| 4.x | Stable | Core 3.1 | 3.1 |
-| | | Core 3.1 | 5 |
+| 4.x | Stable | Core 3.1 | 3.1, 5 |
| | | 5 | 5 |
| | | 6 | 5 |
| 5.0.0-5.0.2 | Stable | 6 | 6 |
-| 5.0.3+ | Stable | 6 | 6 |
-| | | 6 | 7 |
+| 5.0.3-5.4.0 | Stable | 6 | 6, 7 |
| | | 7 | 7 |
+| 5.5+ | Stable | 6 | 6, 7 |
+| | | 7 | 7 |
+| | | 8 | 8 |
+| master | Preview | 6 | 6, 7 |
+| | | 7 | 7 |
+| | | 8 | 8 |
+| openapi | Preview | 6 | 6, 7 |
+| | | 7 | 7 |
+| | | 8 | 8 |
## Contributing
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/docs/generate-examples.ps1 b/docs/generate-examples.ps1
index 4b13408460..ea6b2bd8f2 100644
--- a/docs/generate-examples.ps1
+++ b/docs/generate-examples.ps1
@@ -34,7 +34,7 @@ function Start-WebServer {
Write-Output "Starting web server"
$startTimeUtc = Get-Date -AsUTC
$job = Start-Job -ScriptBlock {
- dotnet run --project ..\src\Examples\GettingStarted\GettingStarted.csproj --configuration Debug --property:TreatWarningsAsErrors=True --urls=http://0.0.0.0:14141
+ dotnet run --project ..\src\Examples\GettingStarted\GettingStarted.csproj --framework net8.0 --configuration Debug --property:TreatWarningsAsErrors=True --urls=http://0.0.0.0:14141
}
$webProcessId = $null
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..94bfde5374
--- /dev/null
+++ b/package-versions.props
@@ -0,0 +1,46 @@
+
+
+
+ 4.1.0
+ 0.4.1
+ 2.14.1
+
+
+ 0.13.*
+ 34.0.*
+ 3.8.*
+ 4.7.*
+ 6.0.*
+ 2.1.*
+ 2.1.*
+ 6.12.*
+ 2.3.*
+ 1.3.*
+ 2023.2.*
+ 1.1.*
+ 17.8.*
+ 2.5.*
+
+
+
+
+ 8.0.0-*
+
+
+ 8.0.0-*
+ 8.0.0-*
+ 8.0.0-*
+ $(AspNetCoreVersion)
+
+
+
+
+ 6.0.0
+
+
+ 6.0.*
+ 7.0.*
+ 7.0.*
+ 7.0.*
+
+
diff --git a/src/Examples/DapperExample/DapperExample.csproj b/src/Examples/DapperExample/DapperExample.csproj
index 4445af8c1e..19519db8e6 100644
--- a/src/Examples/DapperExample/DapperExample.csproj
+++ b/src/Examples/DapperExample/DapperExample.csproj
@@ -1,8 +1,10 @@
- $(TargetFrameworkName)
+ net8.0;net6.0
+
+
{
- private readonly ISystemClock _systemClock;
+ private readonly IClock _clock;
- public TodoItemDefinition(IResourceGraph resourceGraph, ISystemClock systemClock)
+ public TodoItemDefinition(IResourceGraph resourceGraph, IClock clock)
: base(resourceGraph)
{
- ArgumentGuard.NotNull(systemClock);
+ ArgumentGuard.NotNull(clock);
- _systemClock = systemClock;
+ _clock = clock;
}
public override SortExpression OnApplySort(SortExpression? existingSort)
@@ -41,11 +40,11 @@ public override Task OnWritingAsync(TodoItem resource, WriteOperationKind writeO
{
if (writeOperation == WriteOperationKind.CreateResource)
{
- resource.CreatedAt = _systemClock.UtcNow;
+ resource.CreatedAt = _clock.UtcNow;
}
else if (writeOperation == WriteOperationKind.UpdateResource)
{
- resource.LastModifiedAt = _systemClock.UtcNow;
+ resource.LastModifiedAt = _clock.UtcNow;
}
return Task.CompletedTask;
diff --git a/src/Examples/DapperExample/IClock.cs b/src/Examples/DapperExample/IClock.cs
new file mode 100644
index 0000000000..0319c42480
--- /dev/null
+++ b/src/Examples/DapperExample/IClock.cs
@@ -0,0 +1,6 @@
+namespace DapperExample;
+
+public interface IClock
+{
+ DateTimeOffset UtcNow { get; }
+}
diff --git a/src/Examples/DapperExample/Program.cs b/src/Examples/DapperExample/Program.cs
index e19e45478f..00ab54ca97 100644
--- a/src/Examples/DapperExample/Program.cs
+++ b/src/Examples/DapperExample/Program.cs
@@ -9,7 +9,6 @@
using JsonApiDotNetCore.AtomicOperations;
using JsonApiDotNetCore.Configuration;
using JsonApiDotNetCore.Repositories;
-using Microsoft.AspNetCore.Authentication;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Diagnostics;
using Microsoft.Extensions.DependencyInjection.Extensions;
@@ -18,7 +17,7 @@
// Add services to the container.
-builder.Services.TryAddSingleton();
+builder.Services.TryAddSingleton();
DatabaseProvider databaseProvider = GetDatabaseProvider(builder.Configuration);
string? connectionString = builder.Configuration.GetConnectionString($"DapperExample{databaseProvider}");
diff --git a/src/Examples/DapperExample/SystemClock.cs b/src/Examples/DapperExample/SystemClock.cs
new file mode 100644
index 0000000000..3fed87c586
--- /dev/null
+++ b/src/Examples/DapperExample/SystemClock.cs
@@ -0,0 +1,6 @@
+namespace DapperExample;
+
+public sealed class SystemClock : IClock
+{
+ public DateTimeOffset UtcNow => DateTimeOffset.UtcNow;
+}
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/DapperTests/DapperTests.csproj b/test/DapperTests/DapperTests.csproj
index c7ce96a37a..45d9c6a88d 100644
--- a/test/DapperTests/DapperTests.csproj
+++ b/test/DapperTests/DapperTests.csproj
@@ -1,8 +1,10 @@
- $(TargetFrameworkName)
+ net8.0;net6.0
+
+
diff --git a/test/DapperTests/IntegrationTests/DapperTestContext.cs b/test/DapperTests/IntegrationTests/DapperTestContext.cs
index 084444e896..ffc1b81ba9 100644
--- a/test/DapperTests/IntegrationTests/DapperTestContext.cs
+++ b/test/DapperTests/IntegrationTests/DapperTestContext.cs
@@ -8,7 +8,6 @@
using FluentAssertions.Extensions;
using JetBrains.Annotations;
using JsonApiDotNetCore.Configuration;
-using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc.Testing;
using Microsoft.EntityFrameworkCore;
@@ -17,6 +16,7 @@
using Microsoft.Extensions.Logging;
using TestBuildingBlocks;
using Xunit.Abstractions;
+using IClock = DapperExample.IClock;
namespace DapperTests.IntegrationTests;
@@ -74,7 +74,7 @@ private WebApplicationFactory CreateFactory()
builder.ConfigureServices(services =>
{
- services.AddSingleton(new FrozenSystemClock
+ services.AddSingleton(new FrozenClock
{
UtcNow = FrozenTime
});
@@ -114,7 +114,9 @@ public async Task ClearAllTablesAsync(DbContext dbContext)
_ => throw new NotSupportedException($"Unsupported database provider '{databaseProvider}'.")
};
+#pragma warning disable EF1002 // Risk of vulnerability to SQL injection.
await dbContext.Database.ExecuteSqlRawAsync($"DELETE FROM {escapedTableName}");
+#pragma warning restore EF1002 // Risk of vulnerability to SQL injection.
}
}
}
diff --git a/test/DapperTests/IntegrationTests/FrozenClock.cs b/test/DapperTests/IntegrationTests/FrozenClock.cs
new file mode 100644
index 0000000000..0de2390b71
--- /dev/null
+++ b/test/DapperTests/IntegrationTests/FrozenClock.cs
@@ -0,0 +1,11 @@
+using DapperExample;
+using FluentAssertions.Extensions;
+
+namespace DapperTests.IntegrationTests;
+
+internal sealed class FrozenClock : IClock
+{
+ private static readonly DateTimeOffset DefaultTime = 1.January(2020).At(1, 1, 1).AsUtc();
+
+ public DateTimeOffset UtcNow { get; set; } = DefaultTime;
+}
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 99b3b3bc5b..5639d44f40 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 5bd4acb39e..62013322e5 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 3edb88b14a..f98bc1b49d 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 4a8b7d9e52..98564f3a57 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 a9d0fbd44b..6db0926773 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 0af67d4c20..943d2d9bb4 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/InputValidation/ModelState/ModelStateValidationTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/InputValidation/ModelState/ModelStateValidationTests.cs
index 55e293aab1..e6e83fa7c3 100644
--- a/test/JsonApiDotNetCoreTests/IntegrationTests/InputValidation/ModelState/ModelStateValidationTests.cs
+++ b/test/JsonApiDotNetCoreTests/IntegrationTests/InputValidation/ModelState/ModelStateValidationTests.cs
@@ -1,9 +1,11 @@
using System.Net;
using FluentAssertions;
using JsonApiDotNetCore.Serialization.Objects;
-using Microsoft.Extensions.DependencyInjection;
using TestBuildingBlocks;
using Xunit;
+#if NET6_0
+using Microsoft.Extensions.DependencyInjection;
+#endif
namespace JsonApiDotNetCoreTests.IntegrationTests.InputValidation.ModelState;
@@ -19,11 +21,13 @@ public ModelStateValidationTests(IntegrationTestContext();
testContext.UseController();
+#if NET6_0
testContext.ConfigureServices(services =>
{
// Polyfill for missing DateOnly/TimeOnly support in .NET 6 ModelState validation.
services.AddDateOnlyTimeOnlyStringConverters();
});
+#endif
}
[Fact]
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 baec74602b..8b8062674c 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 403f86757b..7dd8c92726 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 f750826f8c..7bd7fe66f1 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..38d665aa5b 100644
--- a/test/JsonApiDotNetCoreTests/JsonApiDotNetCoreTests.csproj
+++ b/test/JsonApiDotNetCoreTests/JsonApiDotNetCoreTests.csproj
@@ -1,8 +1,10 @@
- $(TargetFrameworkName)
+ net8.0;net6.0
+
+
-
+
diff --git a/test/MultiDbContextTests/MultiDbContextTests.csproj b/test/MultiDbContextTests/MultiDbContextTests.csproj
index 394d72e2d2..54497bfada 100644
--- a/test/MultiDbContextTests/MultiDbContextTests.csproj
+++ b/test/MultiDbContextTests/MultiDbContextTests.csproj
@@ -1,8 +1,10 @@
- $(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
+
+