diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json
index 6dc2459ae5..c8c97435a8 100644
--- a/.config/dotnet-tools.json
+++ b/.config/dotnet-tools.json
@@ -3,7 +3,7 @@
"isRoot": true,
"tools": {
"jetbrains.resharper.globaltools": {
- "version": "2023.2.3",
+ "version": "2023.3.0-eap08",
"commands": [
"jb"
]
@@ -21,7 +21,7 @@
]
},
"docfx": {
- "version": "2.72.1",
+ "version": "2.74.0",
"commands": [
"docfx"
]
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 08df1de510..ca7042c976 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -47,12 +47,13 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
- dotnet-version: 6.0.x
+ dotnet-version: |
+ 6.0.x
+ 8.0.x
- name: Setup PowerShell (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: |
- # Temporary version downgrade because .NET 8 is not installed on runner.
- dotnet tool install --global PowerShell --version 7.3.10
+ dotnet tool install --global PowerShell
- name: Find latest PowerShell version (Windows)
if: matrix.os == 'windows-latest'
shell: pwsh
@@ -182,7 +183,9 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
- dotnet-version: 6.0.x
+ dotnet-version: |
+ 6.0.x
+ 8.0.x
- name: Git checkout
uses: actions/checkout@v4
- name: Restore tools
@@ -193,7 +196,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: |
@@ -233,7 +236,9 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
- dotnet-version: 6.0.x
+ dotnet-version: |
+ 6.0.x
+ 8.0.x
- name: Git checkout
uses: actions/checkout@v4
with:
@@ -254,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/.github/workflows/codeql.yml b/.github/workflows/codeql.yml
new file mode 100644
index 0000000000..5b1868eae5
--- /dev/null
+++ b/.github/workflows/codeql.yml
@@ -0,0 +1,43 @@
+name: "CodeQL"
+
+on:
+ push:
+ branches: [ 'master', 'release/**' ]
+ pull_request:
+ # The branches below must be a subset of the branches above
+ branches: [ 'master', 'release/**' ]
+ schedule:
+ - cron: '0 0 * * 5'
+
+jobs:
+ analyze:
+ name: Analyze
+ runs-on: 'ubuntu-latest'
+ timeout-minutes: 60
+ permissions:
+ actions: read
+ contents: read
+ security-events: write
+ strategy:
+ fail-fast: false
+ matrix:
+ language: [ 'csharp' ]
+ steps:
+ - name: Setup .NET
+ uses: actions/setup-dotnet@v3
+ with:
+ dotnet-version: |
+ 6.0.x
+ 8.0.x
+ - name: Git checkout
+ uses: actions/checkout@v4
+ - name: Initialize CodeQL
+ uses: github/codeql-action/init@v2
+ with:
+ languages: ${{ matrix.language }}
+ - name: Autobuild
+ uses: github/codeql-action/autobuild@v2
+ - name: Perform CodeQL Analysis
+ uses: github/codeql-action/analyze@v2
+ with:
+ category: "/language:${{matrix.language}}"
diff --git a/Directory.Build.props b/Directory.Build.props
index d780fbefbf..7ce9eb9a00 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -13,43 +13,15 @@
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.*
- 8.0.*
- 7.0.*
- 17.8.*
- 2.5.*
-
-
-
-
+
+
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/JsonApiDotNetCore.sln.DotSettings b/JsonApiDotNetCore.sln.DotSettings
index bf7a5182f0..a945c3a40d 100644
--- a/JsonApiDotNetCore.sln.DotSettings
+++ b/JsonApiDotNetCore.sln.DotSettings
@@ -66,6 +66,7 @@ JsonApiDotNetCore.ArgumentGuard.NotNull($EXPR$);
WARNING
WARNING
WARNING
+ SUGGESTION
SUGGESTION
SUGGESTION
DO_NOT_SHOW
@@ -92,7 +93,9 @@ JsonApiDotNetCore.ArgumentGuard.NotNull($EXPR$);
WARNING
SUGGESTION
SUGGESTION
+ SUGGESTION
WARNING
+ SUGGESTION
<?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></Profile>
JADNC Full Cleanup
Required
@@ -113,6 +116,7 @@ JsonApiDotNetCore.ArgumentGuard.NotNull($EXPR$);
True
True
True
+ INDENT
1
1
False
@@ -125,6 +129,7 @@ JsonApiDotNetCore.ArgumentGuard.NotNull($EXPR$);
False
False
True
+ 1
NEVER
NEVER
False
@@ -145,6 +150,7 @@ JsonApiDotNetCore.ArgumentGuard.NotNull($EXPR$);
True
WRAP_IF_LONG
160
+ CHOP_IF_LONG
WRAP_IF_LONG
CHOP_ALWAYS
CHOP_ALWAYS
diff --git a/README.md b/README.md
index fe2658711f..f34dfd1bee 100644
--- a/README.md
+++ b/README.md
@@ -76,17 +76,24 @@ app.MapControllers();
The following chart should help you pick the best version, based on your environment.
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 |
-| | | 5 | 5 |
-| | | 6 | 5 |
-| 5.0.0-5.0.2 | Stable | 6 | 6 |
-| 5.0.3+ | Stable | 6 | 6 |
-| | | 6 | 7 |
-| | | 7 | 7 |
+| JsonApiDotNetCore | Status | .NET | Entity Framework Core |
+| ----------------- | ------------ | -------- | --------------------- |
+| 3.x | Stable | Core 2.x | 2.x |
+| 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-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 | Experimental | 6 | 6, 7 |
+| | | 7 | 7 |
+| | | 8 | 8 |
## Contributing
diff --git a/WarningSeverities.DotSettings b/WarningSeverities.DotSettings
index 96f358da23..5c641e606f 100644
--- a/WarningSeverities.DotSettings
+++ b/WarningSeverities.DotSettings
@@ -124,6 +124,7 @@
WARNING
WARNING
WARNING
+ WARNING
WARNING
WARNING
WARNING
@@ -163,6 +164,7 @@
WARNING
WARNING
WARNING
+ WARNING
WARNING
WARNING
WARNING
@@ -240,6 +242,7 @@
WARNING
WARNING
WARNING
+ WARNING
WARNING
WARNING
WARNING
@@ -258,10 +261,12 @@
WARNING
WARNING
WARNING
+ WARNING
WARNING
WARNING
WARNING
WARNING
WARNING
WARNING
+ WARNING
\ No newline at end of file
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/benchmarks/QueryString/QueryStringParserBenchmarks.cs b/benchmarks/QueryString/QueryStringParserBenchmarks.cs
index 2f466a3fcb..0b2f88134a 100644
--- a/benchmarks/QueryString/QueryStringParserBenchmarks.cs
+++ b/benchmarks/QueryString/QueryStringParserBenchmarks.cs
@@ -1,7 +1,6 @@
using System.ComponentModel.Design;
using BenchmarkDotNet.Attributes;
using Benchmarks.Tools;
-using JsonApiDotNetCore;
using JsonApiDotNetCore.Configuration;
using JsonApiDotNetCore.Middleware;
using JsonApiDotNetCore.Queries.Parsing;
@@ -55,8 +54,14 @@ public QueryStringParserBenchmarks()
var paginationParser = new PaginationParser();
var paginationReader = new PaginationQueryStringParameterReader(paginationParser, request, resourceGraph, options);
- IQueryStringParameterReader[] readers = ArrayFactory.Create(includeReader, filterReader, sortReader,
- sparseFieldSetReader, paginationReader);
+ IQueryStringParameterReader[] readers =
+ [
+ includeReader,
+ filterReader,
+ sortReader,
+ sparseFieldSetReader,
+ paginationReader
+ ];
_queryStringReader = new QueryStringReader(options, _queryStringAccessor, readers, NullLoggerFactory.Instance);
}
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..dd842f59f6
--- /dev/null
+++ b/package-versions.props
@@ -0,0 +1,42 @@
+
+
+
+ 4.1.0
+ 0.4.1
+ 2.14.1
+
+
+ 0.13.*
+ 34.0.*
+ 4.7.*
+ 6.0.*
+ 2.1.*
+ 6.12.*
+ 2.3.*
+ 1.3.*
+ 8.0.*
+ 17.8.*
+ 2.5.*
+
+
+
+
+ 8.0.0
+
+
+ 8.0.*
+ 8.0.*-*
+ $(AspNetCoreVersion)
+
+
+
+
+ 6.0.0
+
+
+ 6.0.*
+ 2.1.*
+ 7.0.*
+ 7.0.*
+
+
diff --git a/src/Examples/DapperExample/DapperExample.csproj b/src/Examples/DapperExample/DapperExample.csproj
index 4445af8c1e..f49c3e4b40 100644
--- a/src/Examples/DapperExample/DapperExample.csproj
+++ b/src/Examples/DapperExample/DapperExample.csproj
@@ -1,8 +1,10 @@
- $(TargetFrameworkName)
+ net8.0;net6.0
+
+
-
+
diff --git a/src/Examples/DapperExample/Data/RotatingList.cs b/src/Examples/DapperExample/Data/RotatingList.cs
index 3fa04762a3..67c19bea4a 100644
--- a/src/Examples/DapperExample/Data/RotatingList.cs
+++ b/src/Examples/DapperExample/Data/RotatingList.cs
@@ -4,7 +4,7 @@ internal abstract class RotatingList
{
public static RotatingList Create(int count, Func createElement)
{
- List elements = new();
+ List elements = [];
for (int index = 0; index < count; index++)
{
diff --git a/src/Examples/DapperExample/Definitions/TodoItemDefinition.cs b/src/Examples/DapperExample/Definitions/TodoItemDefinition.cs
index 77bf6f9548..dc7c1802c8 100644
--- a/src/Examples/DapperExample/Definitions/TodoItemDefinition.cs
+++ b/src/Examples/DapperExample/Definitions/TodoItemDefinition.cs
@@ -6,21 +6,20 @@
using JsonApiDotNetCore.Middleware;
using JsonApiDotNetCore.Queries.Expressions;
using JsonApiDotNetCore.Resources;
-using Microsoft.AspNetCore.Authentication;
namespace DapperExample.Definitions;
[UsedImplicitly(ImplicitUseKindFlags.InstantiatedNoFixedConstructorSignature)]
public sealed class TodoItemDefinition : JsonApiResourceDefinition
{
- 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)
@@ -30,22 +29,21 @@ public override SortExpression OnApplySort(SortExpression? existingSort)
private SortExpression GetDefaultSortOrder()
{
- return CreateSortExpressionFromLambda(new PropertySortOrder
- {
+ return CreateSortExpressionFromLambda([
(todoItem => todoItem.Priority, ListSortDirection.Ascending),
(todoItem => todoItem.LastModifiedAt, ListSortDirection.Descending)
- });
+ ]);
}
public override Task OnWritingAsync(TodoItem resource, WriteOperationKind writeOperation, CancellationToken cancellationToken)
{
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/Repositories/DapperFacade.cs b/src/Examples/DapperExample/Repositories/DapperFacade.cs
index d3247967f9..4d30e430c7 100644
--- a/src/Examples/DapperExample/Repositories/DapperFacade.cs
+++ b/src/Examples/DapperExample/Repositories/DapperFacade.cs
@@ -38,7 +38,7 @@ public IReadOnlyCollection BuildSqlCommandsForOneToOneRelatio
{
ArgumentGuard.NotNull(changeDetector);
- List sqlCommands = new();
+ List sqlCommands = [];
foreach ((HasOneAttribute relationship, (object? currentRightId, object newRightId)) in changeDetector.GetOneToOneRelationshipsChangedToNotNull())
{
@@ -81,7 +81,7 @@ public IReadOnlyCollection BuildSqlCommandsForChangedRelation
{
ArgumentGuard.NotNull(changeDetector);
- List sqlCommands = new();
+ List sqlCommands = [];
foreach ((HasOneAttribute hasOneRelationship, (object? currentRightId, object? newRightId)) in changeDetector
.GetChangedToOneRelationshipsWithForeignKeyAtRightSide())
diff --git a/src/Examples/DapperExample/Repositories/DapperRepository.cs b/src/Examples/DapperExample/Repositories/DapperRepository.cs
index bbbeda2ea3..c263ad7767 100644
--- a/src/Examples/DapperExample/Repositories/DapperRepository.cs
+++ b/src/Examples/DapperExample/Repositories/DapperRepository.cs
@@ -161,7 +161,7 @@ public async Task> GetAsync(QueryLayer queryLayer
}
///
- public async Task CountAsync(FilterExpression? filter, CancellationToken cancellationToken)
+ public Task CountAsync(FilterExpression? filter, CancellationToken cancellationToken)
{
var queryLayer = new QueryLayer(ResourceType)
{
@@ -173,7 +173,7 @@ public async Task CountAsync(FilterExpression? filter, CancellationToken ca
CommandDefinition sqlCommand = _dapperFacade.GetSqlCommand(selectNode, cancellationToken);
LogSqlCommand(sqlCommand);
- return await ExecuteQueryAsync(async connection => await connection.ExecuteScalarAsync(sqlCommand), cancellationToken);
+ return ExecuteQueryAsync(connection => connection.ExecuteScalarAsync(sqlCommand), cancellationToken);
}
///
diff --git a/src/Examples/DapperExample/Repositories/ResourceChangeDetector.cs b/src/Examples/DapperExample/Repositories/ResourceChangeDetector.cs
index bd6537b547..1d9b998340 100644
--- a/src/Examples/DapperExample/Repositories/ResourceChangeDetector.cs
+++ b/src/Examples/DapperExample/Repositories/ResourceChangeDetector.cs
@@ -15,11 +15,11 @@ internal sealed class ResourceChangeDetector
private readonly CollectionConverter _collectionConverter = new();
private readonly IDataModelService _dataModelService;
- private Dictionary _currentColumnValues = new();
- private Dictionary _newColumnValues = new();
+ private Dictionary _currentColumnValues = [];
+ private Dictionary _newColumnValues = [];
- private Dictionary> _currentRightResourcesByRelationship = new();
- private Dictionary> _newRightResourcesByRelationship = new();
+ private Dictionary> _currentRightResourcesByRelationship = [];
+ private Dictionary> _newRightResourcesByRelationship = [];
public ResourceType ResourceType { get; }
@@ -52,7 +52,7 @@ public void CaptureNewValues(IIdentifiable resource)
private Dictionary CaptureColumnValues(IIdentifiable resource)
{
- Dictionary columnValues = new();
+ Dictionary columnValues = [];
foreach ((string columnName, ResourceFieldAttribute? _) in _dataModelService.GetColumnMappings(ResourceType))
{
@@ -64,7 +64,7 @@ public void CaptureNewValues(IIdentifiable resource)
private Dictionary> CaptureRightResourcesByRelationship(IIdentifiable resource)
{
- Dictionary> relationshipValues = new();
+ Dictionary> relationshipValues = [];
foreach (RelationshipAttribute relationship in ResourceType.Relationships)
{
@@ -107,7 +107,7 @@ public void AssertIsNotClearingAnyRequiredToOneRelationships(string resourceName
public IReadOnlyDictionary GetOneToOneRelationshipsChangedToNotNull()
{
- Dictionary changes = new();
+ Dictionary changes = [];
foreach ((RelationshipAttribute relationship, ISet newRightResources) in _newRightResourcesByRelationship)
{
@@ -135,7 +135,7 @@ public void AssertIsNotClearingAnyRequiredToOneRelationships(string resourceName
public IReadOnlyDictionary GetChangedColumnValues()
{
- Dictionary changes = new();
+ Dictionary changes = [];
foreach ((string columnName, object? newColumnValue) in _newColumnValues)
{
@@ -152,7 +152,7 @@ public void AssertIsNotClearingAnyRequiredToOneRelationships(string resourceName
public IReadOnlyDictionary GetChangedToOneRelationshipsWithForeignKeyAtRightSide()
{
- Dictionary changes = new();
+ Dictionary changes = [];
foreach ((RelationshipAttribute relationship, ISet newRightResources) in _newRightResourcesByRelationship)
{
@@ -183,7 +183,7 @@ public void AssertIsNotClearingAnyRequiredToOneRelationships(string resourceName
public IReadOnlyDictionary currentRightIds, ISet
+
+
$(JsonApiDotNetCoreVersionPrefix)
jsonapidotnetcore;jsonapi;json:api;dotnet;asp.net;rest;web-api
diff --git a/src/JsonApiDotNetCore/ArrayFactory.cs b/src/JsonApiDotNetCore/ArrayFactory.cs
deleted file mode 100644
index 6ad678c64d..0000000000
--- a/src/JsonApiDotNetCore/ArrayFactory.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-#pragma warning disable AV1008 // Class should not be static
-#pragma warning disable AV1130 // Return type in method signature should be an interface to an unchangeable collection
-
-namespace JsonApiDotNetCore;
-
-internal static class ArrayFactory
-{
- public static T[] Create(params T[] items)
- {
- return items;
- }
-}
diff --git a/src/JsonApiDotNetCore/AtomicOperations/OperationsProcessor.cs b/src/JsonApiDotNetCore/AtomicOperations/OperationsProcessor.cs
index cf1cdd7b65..9e78fcfcbe 100644
--- a/src/JsonApiDotNetCore/AtomicOperations/OperationsProcessor.cs
+++ b/src/JsonApiDotNetCore/AtomicOperations/OperationsProcessor.cs
@@ -99,7 +99,7 @@ public OperationsProcessor(IOperationProcessorAccessor operationProcessorAccesso
return results;
}
- protected virtual async Task ProcessOperationAsync(OperationContainer operation, CancellationToken cancellationToken)
+ protected virtual Task ProcessOperationAsync(OperationContainer operation, CancellationToken cancellationToken)
{
cancellationToken.ThrowIfCancellationRequested();
@@ -108,7 +108,7 @@ public OperationsProcessor(IOperationProcessorAccessor operationProcessorAccesso
_targetedFields.CopyFrom(operation.TargetedFields);
_request.CopyFrom(operation.Request);
- return await _operationProcessorAccessor.ProcessAsync(operation, cancellationToken);
+ return _operationProcessorAccessor.ProcessAsync(operation, cancellationToken);
}
protected void TrackLocalIdsForOperation(OperationContainer operation)
diff --git a/src/JsonApiDotNetCore/AtomicOperations/Processors/IAddToRelationshipProcessor.cs b/src/JsonApiDotNetCore/AtomicOperations/Processors/IAddToRelationshipProcessor.cs
index 8b9990342a..91d23e3358 100644
--- a/src/JsonApiDotNetCore/AtomicOperations/Processors/IAddToRelationshipProcessor.cs
+++ b/src/JsonApiDotNetCore/AtomicOperations/Processors/IAddToRelationshipProcessor.cs
@@ -16,6 +16,4 @@ namespace JsonApiDotNetCore.AtomicOperations.Processors;
///
[PublicAPI]
public interface IAddToRelationshipProcessor : IOperationProcessor
- where TResource : class, IIdentifiable
-{
-}
+ where TResource : class, IIdentifiable;
diff --git a/src/JsonApiDotNetCore/AtomicOperations/Processors/ICreateProcessor.cs b/src/JsonApiDotNetCore/AtomicOperations/Processors/ICreateProcessor.cs
index 9fd1de2186..6cc04043f3 100644
--- a/src/JsonApiDotNetCore/AtomicOperations/Processors/ICreateProcessor.cs
+++ b/src/JsonApiDotNetCore/AtomicOperations/Processors/ICreateProcessor.cs
@@ -16,6 +16,4 @@ namespace JsonApiDotNetCore.AtomicOperations.Processors;
///
[PublicAPI]
public interface ICreateProcessor : IOperationProcessor
- where TResource : class, IIdentifiable
-{
-}
+ where TResource : class, IIdentifiable;
diff --git a/src/JsonApiDotNetCore/AtomicOperations/Processors/IDeleteProcessor.cs b/src/JsonApiDotNetCore/AtomicOperations/Processors/IDeleteProcessor.cs
index 67627cd8c0..42f5f71c14 100644
--- a/src/JsonApiDotNetCore/AtomicOperations/Processors/IDeleteProcessor.cs
+++ b/src/JsonApiDotNetCore/AtomicOperations/Processors/IDeleteProcessor.cs
@@ -16,6 +16,4 @@ namespace JsonApiDotNetCore.AtomicOperations.Processors;
///
[PublicAPI]
public interface IDeleteProcessor : IOperationProcessor
- where TResource : class, IIdentifiable
-{
-}
+ where TResource : class, IIdentifiable;
diff --git a/src/JsonApiDotNetCore/AtomicOperations/Processors/IRemoveFromRelationshipProcessor.cs b/src/JsonApiDotNetCore/AtomicOperations/Processors/IRemoveFromRelationshipProcessor.cs
index 6492c992f1..2dc7bdb17d 100644
--- a/src/JsonApiDotNetCore/AtomicOperations/Processors/IRemoveFromRelationshipProcessor.cs
+++ b/src/JsonApiDotNetCore/AtomicOperations/Processors/IRemoveFromRelationshipProcessor.cs
@@ -12,6 +12,4 @@ namespace JsonApiDotNetCore.AtomicOperations.Processors;
///
[PublicAPI]
public interface IRemoveFromRelationshipProcessor : IOperationProcessor
- where TResource : class, IIdentifiable
-{
-}
+ where TResource : class, IIdentifiable;
diff --git a/src/JsonApiDotNetCore/AtomicOperations/Processors/ISetRelationshipProcessor.cs b/src/JsonApiDotNetCore/AtomicOperations/Processors/ISetRelationshipProcessor.cs
index dd950d203d..7928aa76b0 100644
--- a/src/JsonApiDotNetCore/AtomicOperations/Processors/ISetRelationshipProcessor.cs
+++ b/src/JsonApiDotNetCore/AtomicOperations/Processors/ISetRelationshipProcessor.cs
@@ -16,6 +16,4 @@ namespace JsonApiDotNetCore.AtomicOperations.Processors;
///
[PublicAPI]
public interface ISetRelationshipProcessor : IOperationProcessor
- where TResource : class, IIdentifiable
-{
-}
+ where TResource : class, IIdentifiable;
diff --git a/src/JsonApiDotNetCore/AtomicOperations/Processors/IUpdateProcessor.cs b/src/JsonApiDotNetCore/AtomicOperations/Processors/IUpdateProcessor.cs
index 6051837749..77b83f65f7 100644
--- a/src/JsonApiDotNetCore/AtomicOperations/Processors/IUpdateProcessor.cs
+++ b/src/JsonApiDotNetCore/AtomicOperations/Processors/IUpdateProcessor.cs
@@ -17,6 +17,4 @@ namespace JsonApiDotNetCore.AtomicOperations.Processors;
///
[PublicAPI]
public interface IUpdateProcessor : IOperationProcessor
- where TResource : class, IIdentifiable
-{
-}
+ where TResource : class, IIdentifiable;
diff --git a/src/JsonApiDotNetCore/Configuration/ResourceDescriptorAssemblyCache.cs b/src/JsonApiDotNetCore/Configuration/ResourceDescriptorAssemblyCache.cs
index 0e9f5d753f..a220d96e01 100644
--- a/src/JsonApiDotNetCore/Configuration/ResourceDescriptorAssemblyCache.cs
+++ b/src/JsonApiDotNetCore/Configuration/ResourceDescriptorAssemblyCache.cs
@@ -8,7 +8,7 @@ namespace JsonApiDotNetCore.Configuration;
internal sealed class ResourceDescriptorAssemblyCache
{
private readonly TypeLocator _typeLocator = new();
- private readonly Dictionary?> _resourceDescriptorsPerAssembly = new();
+ private readonly Dictionary?> _resourceDescriptorsPerAssembly = [];
public void RegisterAssembly(Assembly assembly)
{
diff --git a/src/JsonApiDotNetCore/Configuration/ResourceGraph.cs b/src/JsonApiDotNetCore/Configuration/ResourceGraph.cs
index 884b8ccd79..e763ec2ae0 100644
--- a/src/JsonApiDotNetCore/Configuration/ResourceGraph.cs
+++ b/src/JsonApiDotNetCore/Configuration/ResourceGraph.cs
@@ -13,8 +13,8 @@ public sealed class ResourceGraph : IResourceGraph
private static readonly Type? ProxyTargetAccessorType = Type.GetType("Castle.DynamicProxy.IProxyTargetAccessor, Castle.Core");
private readonly IReadOnlySet _resourceTypeSet;
- private readonly Dictionary _resourceTypesByClrType = new();
- private readonly Dictionary _resourceTypesByPublicName = new();
+ private readonly Dictionary _resourceTypesByClrType = [];
+ private readonly Dictionary _resourceTypesByPublicName = [];
public ResourceGraph(IReadOnlySet resourceTypeSet)
{
diff --git a/src/JsonApiDotNetCore/Configuration/ResourceGraphBuilder.cs b/src/JsonApiDotNetCore/Configuration/ResourceGraphBuilder.cs
index 4ea0cb30e6..b0ebd8bb60 100644
--- a/src/JsonApiDotNetCore/Configuration/ResourceGraphBuilder.cs
+++ b/src/JsonApiDotNetCore/Configuration/ResourceGraphBuilder.cs
@@ -17,7 +17,7 @@ public class ResourceGraphBuilder
{
private readonly IJsonApiOptions _options;
private readonly ILogger _logger;
- private readonly Dictionary _resourceTypesByClrType = new();
+ private readonly Dictionary _resourceTypesByClrType = [];
private readonly TypeLocator _typeLocator = new();
public ResourceGraphBuilder(IJsonApiOptions options, ILoggerFactory loggerFactory)
@@ -34,7 +34,7 @@ public ResourceGraphBuilder(IJsonApiOptions options, ILoggerFactory loggerFactor
///
public IResourceGraph Build()
{
- HashSet resourceTypes = _resourceTypesByClrType.Values.ToHashSet();
+ HashSet resourceTypes = [.. _resourceTypesByClrType.Values];
if (!resourceTypes.Any())
{
@@ -81,7 +81,7 @@ private static void SetRelationshipTypes(ResourceGraph resourceGraph)
private static void SetDirectlyDerivedTypes(ResourceGraph resourceGraph)
{
- Dictionary> directlyDerivedTypesPerBaseType = new();
+ Dictionary> directlyDerivedTypesPerBaseType = [];
foreach (ResourceType resourceType in resourceGraph.GetResourceTypes())
{
@@ -93,7 +93,7 @@ private static void SetDirectlyDerivedTypes(ResourceGraph resourceGraph)
if (!directlyDerivedTypesPerBaseType.ContainsKey(baseType))
{
- directlyDerivedTypesPerBaseType[baseType] = new HashSet();
+ directlyDerivedTypesPerBaseType[baseType] = [];
}
directlyDerivedTypesPerBaseType[baseType].Add(resourceType);
diff --git a/src/JsonApiDotNetCore/Configuration/ServiceCollectionExtensions.cs b/src/JsonApiDotNetCore/Configuration/ServiceCollectionExtensions.cs
index 7ea42a2470..b25c208086 100644
--- a/src/JsonApiDotNetCore/Configuration/ServiceCollectionExtensions.cs
+++ b/src/JsonApiDotNetCore/Configuration/ServiceCollectionExtensions.cs
@@ -36,7 +36,7 @@ public static IServiceCollection AddJsonApi(this IServiceCollection
Action? discovery = null, Action? resources = null, IMvcCoreBuilder? mvcBuilder = null)
where TDbContext : DbContext
{
- return AddJsonApi(services, options, discovery, resources, mvcBuilder, typeof(TDbContext).AsArray());
+ return AddJsonApi(services, options, discovery, resources, mvcBuilder, [typeof(TDbContext)]);
}
private static void SetupApplicationBuilder(IServiceCollection services, Action? configureOptions,
diff --git a/src/JsonApiDotNetCore/Configuration/ServiceDiscoveryFacade.cs b/src/JsonApiDotNetCore/Configuration/ServiceDiscoveryFacade.cs
index d17ddfa1ba..01f9ecc7cb 100644
--- a/src/JsonApiDotNetCore/Configuration/ServiceDiscoveryFacade.cs
+++ b/src/JsonApiDotNetCore/Configuration/ServiceDiscoveryFacade.cs
@@ -16,8 +16,8 @@ namespace JsonApiDotNetCore.Configuration;
[PublicAPI]
public sealed class ServiceDiscoveryFacade
{
- internal static readonly HashSet ServiceUnboundInterfaces = new()
- {
+ internal static readonly HashSet ServiceUnboundInterfaces =
+ [
typeof(IResourceService<,>),
typeof(IResourceCommandService<,>),
typeof(IResourceQueryService<,>),
@@ -31,19 +31,16 @@ public sealed class ServiceDiscoveryFacade
typeof(ISetRelationshipService<,>),
typeof(IDeleteService<,>),
typeof(IRemoveFromRelationshipService<,>)
- };
+ ];
- internal static readonly HashSet RepositoryUnboundInterfaces = new()
- {
+ internal static readonly HashSet RepositoryUnboundInterfaces =
+ [
typeof(IResourceRepository<,>),
typeof(IResourceWriteRepository<,>),
typeof(IResourceReadRepository<,>)
- };
+ ];
- internal static readonly HashSet ResourceDefinitionUnboundInterfaces = new()
- {
- typeof(IResourceDefinition<,>)
- };
+ internal static readonly HashSet ResourceDefinitionUnboundInterfaces = [typeof(IResourceDefinition<,>)];
private readonly ILogger _logger;
private readonly IServiceCollection _services;
@@ -155,9 +152,11 @@ private void AddResourceDefinitions(Assembly assembly, ResourceDescriptor resour
private void RegisterImplementations(Assembly assembly, Type interfaceType, ResourceDescriptor resourceDescriptor)
{
- Type[] typeArguments = interfaceType.GetTypeInfo().GenericTypeParameters.Length == 2
- ? ArrayFactory.Create(resourceDescriptor.ResourceClrType, resourceDescriptor.IdClrType)
- : ArrayFactory.Create(resourceDescriptor.ResourceClrType);
+ Type[] typeArguments =
+ [
+ resourceDescriptor.ResourceClrType,
+ resourceDescriptor.IdClrType
+ ];
(Type implementationType, Type serviceInterface)? result = _typeLocator.GetContainerRegistrationFromAssembly(assembly, interfaceType, typeArguments);
diff --git a/src/JsonApiDotNetCore/Controllers/Annotations/DisableRoutingConventionAttribute.cs b/src/JsonApiDotNetCore/Controllers/Annotations/DisableRoutingConventionAttribute.cs
index 34e1132789..19df79dc2b 100644
--- a/src/JsonApiDotNetCore/Controllers/Annotations/DisableRoutingConventionAttribute.cs
+++ b/src/JsonApiDotNetCore/Controllers/Annotations/DisableRoutingConventionAttribute.cs
@@ -11,6 +11,4 @@ namespace JsonApiDotNetCore.Controllers.Annotations;
/// ]]>
[PublicAPI]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct)]
-public sealed class DisableRoutingConventionAttribute : Attribute
-{
-}
+public sealed class DisableRoutingConventionAttribute : Attribute;
diff --git a/src/JsonApiDotNetCore/Controllers/JsonApiController.cs b/src/JsonApiDotNetCore/Controllers/JsonApiController.cs
index 091bbee47b..19c679404f 100644
--- a/src/JsonApiDotNetCore/Controllers/JsonApiController.cs
+++ b/src/JsonApiDotNetCore/Controllers/JsonApiController.cs
@@ -41,77 +41,77 @@ protected JsonApiController(IJsonApiOptions options, IResourceGraph resourceGrap
///
[HttpGet]
[HttpHead]
- public override async Task GetAsync(CancellationToken cancellationToken)
+ public override Task GetAsync(CancellationToken cancellationToken)
{
- return await base.GetAsync(cancellationToken);
+ return base.GetAsync(cancellationToken);
}
///
[HttpGet("{id}")]
[HttpHead("{id}")]
- public override async Task GetAsync(TId id, CancellationToken cancellationToken)
+ public override Task GetAsync(TId id, CancellationToken cancellationToken)
{
- return await base.GetAsync(id, cancellationToken);
+ return base.GetAsync(id, cancellationToken);
}
///
[HttpGet("{id}/{relationshipName}")]
[HttpHead("{id}/{relationshipName}")]
- public override async Task GetSecondaryAsync(TId id, string relationshipName, CancellationToken cancellationToken)
+ public override Task GetSecondaryAsync(TId id, string relationshipName, CancellationToken cancellationToken)
{
- return await base.GetSecondaryAsync(id, relationshipName, cancellationToken);
+ return base.GetSecondaryAsync(id, relationshipName, cancellationToken);
}
///
[HttpGet("{id}/relationships/{relationshipName}")]
[HttpHead("{id}/relationships/{relationshipName}")]
- public override async Task GetRelationshipAsync(TId id, string relationshipName, CancellationToken cancellationToken)
+ public override Task GetRelationshipAsync(TId id, string relationshipName, CancellationToken cancellationToken)
{
- return await base.GetRelationshipAsync(id, relationshipName, cancellationToken);
+ return base.GetRelationshipAsync(id, relationshipName, cancellationToken);
}
///
[HttpPost]
- public override async Task PostAsync([FromBody] TResource resource, CancellationToken cancellationToken)
+ public override Task PostAsync([FromBody] TResource resource, CancellationToken cancellationToken)
{
- return await base.PostAsync(resource, cancellationToken);
+ return base.PostAsync(resource, cancellationToken);
}
///
[HttpPost("{id}/relationships/{relationshipName}")]
- public override async Task PostRelationshipAsync(TId id, string relationshipName, [FromBody] ISet rightResourceIds,
+ public override Task PostRelationshipAsync(TId id, string relationshipName, [FromBody] ISet rightResourceIds,
CancellationToken cancellationToken)
{
- return await base.PostRelationshipAsync(id, relationshipName, rightResourceIds, cancellationToken);
+ return base.PostRelationshipAsync(id, relationshipName, rightResourceIds, cancellationToken);
}
///
[HttpPatch("{id}")]
- public override async Task PatchAsync(TId id, [FromBody] TResource resource, CancellationToken cancellationToken)
+ public override Task PatchAsync(TId id, [FromBody] TResource resource, CancellationToken cancellationToken)
{
- return await base.PatchAsync(id, resource, cancellationToken);
+ return base.PatchAsync(id, resource, cancellationToken);
}
///
[HttpPatch("{id}/relationships/{relationshipName}")]
- public override async Task PatchRelationshipAsync(TId id, string relationshipName, [FromBody] object? rightValue,
+ public override Task PatchRelationshipAsync(TId id, string relationshipName, [FromBody] object? rightValue,
CancellationToken cancellationToken)
{
- return await base.PatchRelationshipAsync(id, relationshipName, rightValue, cancellationToken);
+ return base.PatchRelationshipAsync(id, relationshipName, rightValue, cancellationToken);
}
///
[HttpDelete("{id}")]
- public override async Task DeleteAsync(TId id, CancellationToken cancellationToken)
+ public override Task DeleteAsync(TId id, CancellationToken cancellationToken)
{
- return await base.DeleteAsync(id, cancellationToken);
+ return base.DeleteAsync(id, cancellationToken);
}
///
[HttpDelete("{id}/relationships/{relationshipName}")]
- public override async Task DeleteRelationshipAsync(TId id, string relationshipName, [FromBody] ISet rightResourceIds,
+ public override Task DeleteRelationshipAsync(TId id, string relationshipName, [FromBody] ISet rightResourceIds,
CancellationToken cancellationToken)
{
- return await base.DeleteRelationshipAsync(id, relationshipName, rightResourceIds, cancellationToken);
+ return base.DeleteRelationshipAsync(id, relationshipName, rightResourceIds, cancellationToken);
}
}
diff --git a/src/JsonApiDotNetCore/Controllers/JsonApiOperationsController.cs b/src/JsonApiDotNetCore/Controllers/JsonApiOperationsController.cs
index 452a5eac09..70d65aa7b3 100644
--- a/src/JsonApiDotNetCore/Controllers/JsonApiOperationsController.cs
+++ b/src/JsonApiDotNetCore/Controllers/JsonApiOperationsController.cs
@@ -21,8 +21,8 @@ protected JsonApiOperationsController(IJsonApiOptions options, IResourceGraph re
///
[HttpPost]
- public override async Task PostOperationsAsync([FromBody] IList operations, CancellationToken cancellationToken)
+ public override Task PostOperationsAsync([FromBody] IList operations, CancellationToken cancellationToken)
{
- return await base.PostOperationsAsync(operations, cancellationToken);
+ return base.PostOperationsAsync(operations, cancellationToken);
}
}
diff --git a/src/JsonApiDotNetCore/Diagnostics/CascadingCodeTimer.cs b/src/JsonApiDotNetCore/Diagnostics/CascadingCodeTimer.cs
index 4b4d82b62b..8fc75dad4e 100644
--- a/src/JsonApiDotNetCore/Diagnostics/CascadingCodeTimer.cs
+++ b/src/JsonApiDotNetCore/Diagnostics/CascadingCodeTimer.cs
@@ -12,7 +12,7 @@ internal sealed class CascadingCodeTimer : ICodeTimer
{
private readonly Stopwatch _stopwatch = new();
private readonly Stack _activeScopeStack = new();
- private readonly List _completedScopes = new();
+ private readonly List _completedScopes = [];
static CascadingCodeTimer()
{
diff --git a/src/JsonApiDotNetCore/Errors/InvalidModelStateException.cs b/src/JsonApiDotNetCore/Errors/InvalidModelStateException.cs
index 50cb511b14..ce8ab8a1b0 100644
--- a/src/JsonApiDotNetCore/Errors/InvalidModelStateException.cs
+++ b/src/JsonApiDotNetCore/Errors/InvalidModelStateException.cs
@@ -30,7 +30,7 @@ private static IEnumerable FromModelStateDictionary(IReadOnlyDictio
ArgumentGuard.NotNull(modelType);
ArgumentGuard.NotNull(resourceGraph);
- List errorObjects = new();
+ List errorObjects = [];
foreach ((ModelStateEntry entry, string? sourcePointer) in ResolveSourcePointers(modelState, modelType, resourceGraph,
getCollectionElementTypeCallback))
@@ -207,7 +207,12 @@ private abstract class ModelStateKeySegment
private const char Dot = '.';
private const char BracketOpen = '[';
private const char BracketClose = ']';
- private static readonly char[] KeySegmentStartTokens = ArrayFactory.Create(Dot, BracketOpen);
+
+ private static readonly char[] KeySegmentStartTokens =
+ [
+ Dot,
+ BracketOpen
+ ];
// The right part of the full key, which nested segments are produced from.
private readonly string _nextKey;
diff --git a/src/JsonApiDotNetCore/Errors/JsonApiException.cs b/src/JsonApiDotNetCore/Errors/JsonApiException.cs
index 4571843e8d..097b972089 100644
--- a/src/JsonApiDotNetCore/Errors/JsonApiException.cs
+++ b/src/JsonApiDotNetCore/Errors/JsonApiException.cs
@@ -26,7 +26,7 @@ public JsonApiException(ErrorObject error, Exception? innerException = null)
{
ArgumentGuard.NotNull(error);
- Errors = error.AsArray();
+ Errors = [error];
}
public JsonApiException(IEnumerable errors, Exception? innerException = null)
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/Middleware/ExceptionHandler.cs b/src/JsonApiDotNetCore/Middleware/ExceptionHandler.cs
index 7f7479975a..816c5ffbb7 100644
--- a/src/JsonApiDotNetCore/Middleware/ExceptionHandler.cs
+++ b/src/JsonApiDotNetCore/Middleware/ExceptionHandler.cs
@@ -74,15 +74,21 @@ protected virtual IReadOnlyList CreateErrorResponse(Exception excep
IReadOnlyList errors = exception switch
{
JsonApiException jsonApiException => jsonApiException.Errors,
- OperationCanceledException => new ErrorObject((HttpStatusCode)499)
- {
- Title = "Request execution was canceled."
- }.AsArray(),
- _ => new ErrorObject(HttpStatusCode.InternalServerError)
- {
- Title = "An unhandled error occurred while processing this request.",
- Detail = exception.Message
- }.AsArray()
+ OperationCanceledException =>
+ [
+ new ErrorObject((HttpStatusCode)499)
+ {
+ Title = "Request execution was canceled."
+ }
+ ],
+ _ =>
+ [
+ new ErrorObject(HttpStatusCode.InternalServerError)
+ {
+ Title = "An unhandled error occurred while processing this request.",
+ Detail = exception.Message
+ }
+ ]
};
if (_options.IncludeExceptionStackTraceInErrors && exception is not InvalidModelStateException)
diff --git a/src/JsonApiDotNetCore/Middleware/IAsyncConvertEmptyActionResultFilter.cs b/src/JsonApiDotNetCore/Middleware/IAsyncConvertEmptyActionResultFilter.cs
index 87676657e5..3116b45d40 100644
--- a/src/JsonApiDotNetCore/Middleware/IAsyncConvertEmptyActionResultFilter.cs
+++ b/src/JsonApiDotNetCore/Middleware/IAsyncConvertEmptyActionResultFilter.cs
@@ -14,6 +14,4 @@ namespace JsonApiDotNetCore.Middleware;
/// https://github.com/dotnet/aspnetcore/issues/16969
///
[PublicAPI]
-public interface IAsyncConvertEmptyActionResultFilter : IAsyncAlwaysRunResultFilter
-{
-}
+public interface IAsyncConvertEmptyActionResultFilter : IAsyncAlwaysRunResultFilter;
diff --git a/src/JsonApiDotNetCore/Middleware/IAsyncJsonApiExceptionFilter.cs b/src/JsonApiDotNetCore/Middleware/IAsyncJsonApiExceptionFilter.cs
index fb0cbb9b17..1fc4e136af 100644
--- a/src/JsonApiDotNetCore/Middleware/IAsyncJsonApiExceptionFilter.cs
+++ b/src/JsonApiDotNetCore/Middleware/IAsyncJsonApiExceptionFilter.cs
@@ -7,6 +7,4 @@ namespace JsonApiDotNetCore.Middleware;
/// Application-wide exception filter that invokes for JSON:API requests.
///
[PublicAPI]
-public interface IAsyncJsonApiExceptionFilter : IAsyncExceptionFilter
-{
-}
+public interface IAsyncJsonApiExceptionFilter : IAsyncExceptionFilter;
diff --git a/src/JsonApiDotNetCore/Middleware/IAsyncQueryStringActionFilter.cs b/src/JsonApiDotNetCore/Middleware/IAsyncQueryStringActionFilter.cs
index 0c9cbfbb29..d3df469f64 100644
--- a/src/JsonApiDotNetCore/Middleware/IAsyncQueryStringActionFilter.cs
+++ b/src/JsonApiDotNetCore/Middleware/IAsyncQueryStringActionFilter.cs
@@ -7,6 +7,4 @@ namespace JsonApiDotNetCore.Middleware;
/// Application-wide entry point for processing JSON:API request query strings.
///
[PublicAPI]
-public interface IAsyncQueryStringActionFilter : IAsyncActionFilter
-{
-}
+public interface IAsyncQueryStringActionFilter : IAsyncActionFilter;
diff --git a/src/JsonApiDotNetCore/Middleware/IJsonApiInputFormatter.cs b/src/JsonApiDotNetCore/Middleware/IJsonApiInputFormatter.cs
index cb5fe76167..7879530650 100644
--- a/src/JsonApiDotNetCore/Middleware/IJsonApiInputFormatter.cs
+++ b/src/JsonApiDotNetCore/Middleware/IJsonApiInputFormatter.cs
@@ -7,6 +7,4 @@ namespace JsonApiDotNetCore.Middleware;
/// Application-wide entry point for reading JSON:API request bodies.
///
[PublicAPI]
-public interface IJsonApiInputFormatter : IInputFormatter
-{
-}
+public interface IJsonApiInputFormatter : IInputFormatter;
diff --git a/src/JsonApiDotNetCore/Middleware/IJsonApiOutputFormatter.cs b/src/JsonApiDotNetCore/Middleware/IJsonApiOutputFormatter.cs
index bc7213ebed..ff285e26e7 100644
--- a/src/JsonApiDotNetCore/Middleware/IJsonApiOutputFormatter.cs
+++ b/src/JsonApiDotNetCore/Middleware/IJsonApiOutputFormatter.cs
@@ -7,6 +7,4 @@ namespace JsonApiDotNetCore.Middleware;
/// Application-wide entry point for writing JSON:API response bodies.
///
[PublicAPI]
-public interface IJsonApiOutputFormatter : IOutputFormatter
-{
-}
+public interface IJsonApiOutputFormatter : IOutputFormatter;
diff --git a/src/JsonApiDotNetCore/Middleware/IJsonApiRoutingConvention.cs b/src/JsonApiDotNetCore/Middleware/IJsonApiRoutingConvention.cs
index 86b68a9b03..a83156f33f 100644
--- a/src/JsonApiDotNetCore/Middleware/IJsonApiRoutingConvention.cs
+++ b/src/JsonApiDotNetCore/Middleware/IJsonApiRoutingConvention.cs
@@ -7,6 +7,4 @@ namespace JsonApiDotNetCore.Middleware;
/// Service for specifying which routing convention to use. This can be overridden to customize the relation between controllers and mapped routes.
///
[PublicAPI]
-public interface IJsonApiRoutingConvention : IApplicationModelConvention, IControllerResourceMapping
-{
-}
+public interface IJsonApiRoutingConvention : IApplicationModelConvention, IControllerResourceMapping;
diff --git a/src/JsonApiDotNetCore/Middleware/JsonApiMiddleware.cs b/src/JsonApiDotNetCore/Middleware/JsonApiMiddleware.cs
index 40a784d25c..7cd2573727 100644
--- a/src/JsonApiDotNetCore/Middleware/JsonApiMiddleware.cs
+++ b/src/JsonApiDotNetCore/Middleware/JsonApiMiddleware.cs
@@ -205,7 +205,7 @@ private static async Task FlushResponseAsync(HttpResponse httpResponse, JsonSeri
var errorDocument = new Document
{
- Errors = error.AsList()
+ Errors = [error]
};
await JsonSerializer.SerializeAsync(httpResponse.Body, errorDocument, serializerOptions);
diff --git a/src/JsonApiDotNetCore/Middleware/JsonApiOutputFormatter.cs b/src/JsonApiDotNetCore/Middleware/JsonApiOutputFormatter.cs
index 80d7863251..f88e11c33d 100644
--- a/src/JsonApiDotNetCore/Middleware/JsonApiOutputFormatter.cs
+++ b/src/JsonApiDotNetCore/Middleware/JsonApiOutputFormatter.cs
@@ -16,11 +16,11 @@ public bool CanWriteResult(OutputFormatterCanWriteContext context)
}
///
- public async Task WriteAsync(OutputFormatterWriteContext context)
+ public Task WriteAsync(OutputFormatterWriteContext context)
{
ArgumentGuard.NotNull(context);
var writer = context.HttpContext.RequestServices.GetRequiredService();
- await writer.WriteAsync(context.Object, context.HttpContext);
+ return writer.WriteAsync(context.Object, context.HttpContext);
}
}
diff --git a/src/JsonApiDotNetCore/Middleware/JsonApiRoutingConvention.cs b/src/JsonApiDotNetCore/Middleware/JsonApiRoutingConvention.cs
index a6ef712adf..c2df736e96 100644
--- a/src/JsonApiDotNetCore/Middleware/JsonApiRoutingConvention.cs
+++ b/src/JsonApiDotNetCore/Middleware/JsonApiRoutingConvention.cs
@@ -32,9 +32,9 @@ public sealed class JsonApiRoutingConvention : IJsonApiRoutingConvention
private readonly IJsonApiOptions _options;
private readonly IResourceGraph _resourceGraph;
private readonly ILogger _logger;
- private readonly Dictionary _registeredControllerNameByTemplate = new();
- private readonly Dictionary _resourceTypePerControllerTypeMap = new();
- private readonly Dictionary _controllerPerResourceTypeMap = new();
+ private readonly Dictionary _registeredControllerNameByTemplate = [];
+ private readonly Dictionary _resourceTypePerControllerTypeMap = [];
+ private readonly Dictionary _controllerPerResourceTypeMap = [];
public JsonApiRoutingConvention(IJsonApiOptions options, IResourceGraph resourceGraph, ILogger logger)
{
diff --git a/src/JsonApiDotNetCore/Queries/Expressions/IdentifierExpression.cs b/src/JsonApiDotNetCore/Queries/Expressions/IdentifierExpression.cs
index 5b7d63ef96..5a978b54f6 100644
--- a/src/JsonApiDotNetCore/Queries/Expressions/IdentifierExpression.cs
+++ b/src/JsonApiDotNetCore/Queries/Expressions/IdentifierExpression.cs
@@ -3,6 +3,4 @@ namespace JsonApiDotNetCore.Queries.Expressions;
///
/// Represents the base type for an identifier, such as a JSON:API attribute/relationship name, a constant value between quotes, or null.
///
-public abstract class IdentifierExpression : QueryExpression
-{
-}
+public abstract class IdentifierExpression : QueryExpression;
diff --git a/src/JsonApiDotNetCore/Queries/Expressions/IncludeChainConverter.cs b/src/JsonApiDotNetCore/Queries/Expressions/IncludeChainConverter.cs
index 8b2034a374..f88cb60a86 100644
--- a/src/JsonApiDotNetCore/Queries/Expressions/IncludeChainConverter.cs
+++ b/src/JsonApiDotNetCore/Queries/Expressions/IncludeChainConverter.cs
@@ -46,7 +46,7 @@ private sealed class IncludeToChainsConverter : QueryExpressionVisitor _parentRelationshipStack = new();
- public List Chains { get; } = new();
+ public List Chains { get; } = [];
public override object? VisitInclude(IncludeExpression expression, object? argument)
{
diff --git a/src/JsonApiDotNetCore/Queries/Parsing/FilterParser.cs b/src/JsonApiDotNetCore/Queries/Parsing/FilterParser.cs
index 1af9656154..cbd6ee4b21 100644
--- a/src/JsonApiDotNetCore/Queries/Parsing/FilterParser.cs
+++ b/src/JsonApiDotNetCore/Queries/Parsing/FilterParser.cs
@@ -14,8 +14,8 @@ namespace JsonApiDotNetCore.Queries.Parsing;
[PublicAPI]
public class FilterParser : QueryExpressionParser, IFilterParser
{
- private static readonly HashSet FilterKeywords = new(new[]
- {
+ private static readonly HashSet FilterKeywords =
+ [
Keywords.Not,
Keywords.And,
Keywords.Or,
@@ -31,7 +31,7 @@ public class FilterParser : QueryExpressionParser, IFilterParser
Keywords.Count,
Keywords.Has,
Keywords.IsType
- });
+ ];
private readonly IResourceFactory _resourceFactory;
private readonly Stack _resourceTypeStack = new();
diff --git a/src/JsonApiDotNetCore/Queries/Parsing/IncludeParser.cs b/src/JsonApiDotNetCore/Queries/Parsing/IncludeParser.cs
index 27fffb9467..1ab0e61326 100644
--- a/src/JsonApiDotNetCore/Queries/Parsing/IncludeParser.cs
+++ b/src/JsonApiDotNetCore/Queries/Parsing/IncludeParser.cs
@@ -86,7 +86,7 @@ private void ParseRelationshipChain(string source, IncludeTreeNode treeRoot)
// that there's currently no way to include Products without Articles. We could add such optional upcast syntax
// in the future, if desired.
- ICollection children = ParseRelationshipName(source, treeRoot.AsList());
+ ICollection children = ParseRelationshipName(source, [treeRoot]);
while (TokenStack.TryPeek(out Token? nextToken) && nextToken.Kind == TokenKind.Period)
{
@@ -111,8 +111,8 @@ private ICollection ParseRelationshipName(string source, IColle
private static ICollection LookupRelationshipName(string relationshipName, ICollection parents, string source,
int position)
{
- List children = new();
- HashSet relationshipsFound = new();
+ List children = [];
+ HashSet relationshipsFound = [];
foreach (IncludeTreeNode parent in parents)
{
diff --git a/src/JsonApiDotNetCore/Queries/QueryLayerComposer.cs b/src/JsonApiDotNetCore/Queries/QueryLayerComposer.cs
index d5fac60c71..8e0c97e6c0 100644
--- a/src/JsonApiDotNetCore/Queries/QueryLayerComposer.cs
+++ b/src/JsonApiDotNetCore/Queries/QueryLayerComposer.cs
@@ -272,7 +272,7 @@ public QueryLayer ComposeForGetById(TId id, ResourceType primaryResourceTyp
QueryLayer queryLayer = ComposeFromConstraints(primaryResourceType);
queryLayer.Sort = null;
queryLayer.Pagination = null;
- queryLayer.Filter = CreateFilterByIds(id.AsArray(), idAttribute, queryLayer.Filter);
+ queryLayer.Filter = CreateFilterByIds([id], idAttribute, queryLayer.Filter);
if (fieldSelection == TopFieldSelection.OnlyIdAttribute)
{
@@ -342,7 +342,7 @@ public QueryLayer WrapLayerForSecondaryEndpoint(QueryLayer secondaryLayer,
return new QueryLayer(primaryResourceType)
{
Include = RewriteIncludeForSecondaryEndpoint(innerInclude, relationship),
- Filter = CreateFilterByIds(primaryId.AsArray(), primaryIdAttribute, primaryFilter),
+ Filter = CreateFilterByIds([primaryId], primaryIdAttribute, primaryFilter),
Selection = primarySelection
};
}
@@ -390,7 +390,7 @@ public QueryLayer ComposeForUpdate(TId id, ResourceType primaryResourceType
primaryLayer.Include = includeElements.Any() ? new IncludeExpression(includeElements) : IncludeExpression.Empty;
primaryLayer.Sort = null;
primaryLayer.Pagination = null;
- primaryLayer.Filter = CreateFilterByIds(id.AsArray(), primaryIdAttribute, primaryLayer.Filter);
+ primaryLayer.Filter = CreateFilterByIds([id], primaryIdAttribute, primaryLayer.Filter);
primaryLayer.Selection = null;
return primaryLayer;
@@ -449,7 +449,7 @@ public QueryLayer ComposeForHasMany(HasManyAttribute hasManyRelationship, T
AttrAttribute rightIdAttribute = GetIdAttribute(hasManyRelationship.RightType);
HashSet rightTypedIds = rightResourceIds.Select(resource => resource.GetTypedId()).ToHashSet();
- FilterExpression? leftFilter = CreateFilterByIds(leftId.AsArray(), leftIdAttribute, null);
+ FilterExpression? leftFilter = CreateFilterByIds([leftId], leftIdAttribute, null);
FilterExpression? rightFilter = CreateFilterByIds(rightTypedIds, rightIdAttribute, null);
var secondarySelection = new FieldSelection();
diff --git a/src/JsonApiDotNetCore/Queries/QueryableBuilding/IncludeClauseBuilder.cs b/src/JsonApiDotNetCore/Queries/QueryableBuilding/IncludeClauseBuilder.cs
index 3b0793f774..3bd19eb21f 100644
--- a/src/JsonApiDotNetCore/Queries/QueryableBuilding/IncludeClauseBuilder.cs
+++ b/src/JsonApiDotNetCore/Queries/QueryableBuilding/IncludeClauseBuilder.cs
@@ -22,7 +22,7 @@ public virtual Expression ApplyInclude(IncludeExpression include, QueryClauseBui
public override Expression VisitInclude(IncludeExpression expression, QueryClauseBuilderContext context)
{
// De-duplicate chains coming from derived relationships.
- HashSet propertyPaths = new();
+ HashSet propertyPaths = [];
ApplyEagerLoads(context.ResourceType.EagerLoads, null, propertyPaths);
@@ -75,6 +75,6 @@ private static Expression IncludeExtensionMethodCall(Expression source, Type ent
{
Expression navigationExpression = Expression.Constant(navigationPropertyPath);
- return Expression.Call(typeof(EntityFrameworkQueryableExtensions), "Include", entityType.AsArray(), source, navigationExpression);
+ return Expression.Call(typeof(EntityFrameworkQueryableExtensions), "Include", [entityType], source, navigationExpression);
}
}
diff --git a/src/JsonApiDotNetCore/Queries/QueryableBuilding/LambdaScopeFactory.cs b/src/JsonApiDotNetCore/Queries/QueryableBuilding/LambdaScopeFactory.cs
index cf8a30e1db..257906b69f 100644
--- a/src/JsonApiDotNetCore/Queries/QueryableBuilding/LambdaScopeFactory.cs
+++ b/src/JsonApiDotNetCore/Queries/QueryableBuilding/LambdaScopeFactory.cs
@@ -10,7 +10,7 @@ namespace JsonApiDotNetCore.Queries.QueryableBuilding;
[PublicAPI]
public sealed class LambdaScopeFactory
{
- private readonly HashSet _namesInScope = new();
+ private readonly HashSet _namesInScope = [];
///
/// Finds the next unique lambda parameter name. Dispose the returned scope to release the claimed name, so it can be reused.
diff --git a/src/JsonApiDotNetCore/Queries/QueryableBuilding/OrderClauseBuilder.cs b/src/JsonApiDotNetCore/Queries/QueryableBuilding/OrderClauseBuilder.cs
index 09f0c5326e..93dd7c53d1 100644
--- a/src/JsonApiDotNetCore/Queries/QueryableBuilding/OrderClauseBuilder.cs
+++ b/src/JsonApiDotNetCore/Queries/QueryableBuilding/OrderClauseBuilder.cs
@@ -57,7 +57,12 @@ private static string GetOperationName(bool isAscending, QueryClauseBuilderConte
private static Expression ExtensionMethodCall(Expression source, string operationName, Type keyType, LambdaExpression keySelector,
QueryClauseBuilderContext context)
{
- Type[] typeArguments = ArrayFactory.Create(context.LambdaScope.Parameter.Type, keyType);
+ Type[] typeArguments =
+ [
+ context.LambdaScope.Parameter.Type,
+ keyType
+ ];
+
return Expression.Call(context.ExtensionType, operationName, typeArguments, source, keySelector);
}
}
diff --git a/src/JsonApiDotNetCore/Queries/QueryableBuilding/SelectClauseBuilder.cs b/src/JsonApiDotNetCore/Queries/QueryableBuilding/SelectClauseBuilder.cs
index 3f23013d7c..858532d7c2 100644
--- a/src/JsonApiDotNetCore/Queries/QueryableBuilding/SelectClauseBuilder.cs
+++ b/src/JsonApiDotNetCore/Queries/QueryableBuilding/SelectClauseBuilder.cs
@@ -242,12 +242,17 @@ private static Expression TestForNull(Expression expressionToTest, Expression if
private static Expression CopyCollectionExtensionMethodCall(Expression source, string operationName, Type elementType)
{
- return Expression.Call(typeof(Enumerable), operationName, elementType.AsArray(), source);
+ return Expression.Call(typeof(Enumerable), operationName, [elementType], source);
}
private static Expression SelectExtensionMethodCall(Type extensionType, Expression source, Type elementType, Expression selectBody)
{
- Type[] typeArguments = ArrayFactory.Create(elementType, elementType);
+ Type[] typeArguments =
+ [
+ elementType,
+ elementType
+ ];
+
return Expression.Call(extensionType, "Select", typeArguments, source, selectBody);
}
diff --git a/src/JsonApiDotNetCore/Queries/QueryableBuilding/SkipTakeClauseBuilder.cs b/src/JsonApiDotNetCore/Queries/QueryableBuilding/SkipTakeClauseBuilder.cs
index 2eb2823aca..b48fa696db 100644
--- a/src/JsonApiDotNetCore/Queries/QueryableBuilding/SkipTakeClauseBuilder.cs
+++ b/src/JsonApiDotNetCore/Queries/QueryableBuilding/SkipTakeClauseBuilder.cs
@@ -38,6 +38,6 @@ private static Expression ExtensionMethodCall(Expression source, string operatio
{
Expression constant = value.CreateTupleAccessExpressionForConstant(typeof(int));
- return Expression.Call(context.ExtensionType, operationName, context.LambdaScope.Parameter.Type.AsArray(), source, constant);
+ return Expression.Call(context.ExtensionType, operationName, [context.LambdaScope.Parameter.Type], source, constant);
}
}
diff --git a/src/JsonApiDotNetCore/Queries/QueryableBuilding/WhereClauseBuilder.cs b/src/JsonApiDotNetCore/Queries/QueryableBuilding/WhereClauseBuilder.cs
index 981b2da1a3..f14d795f7b 100644
--- a/src/JsonApiDotNetCore/Queries/QueryableBuilding/WhereClauseBuilder.cs
+++ b/src/JsonApiDotNetCore/Queries/QueryableBuilding/WhereClauseBuilder.cs
@@ -33,7 +33,7 @@ private LambdaExpression GetPredicateLambda(FilterExpression filter, QueryClause
private static Expression WhereExtensionMethodCall(LambdaExpression predicate, QueryClauseBuilderContext context)
{
- return Expression.Call(context.ExtensionType, "Where", context.LambdaScope.Parameter.Type.AsArray(), context.Source, predicate);
+ return Expression.Call(context.ExtensionType, "Where", [context.LambdaScope.Parameter.Type], context.Source, predicate);
}
public override Expression VisitHas(HasExpression expression, QueryClauseBuilderContext context)
@@ -67,8 +67,8 @@ public override Expression VisitHas(HasExpression expression, QueryClauseBuilder
private static MethodCallExpression AnyExtensionMethodCall(Type elementType, Expression source, Expression? predicate)
{
return predicate != null
- ? Expression.Call(typeof(Enumerable), "Any", elementType.AsArray(), source, predicate)
- : Expression.Call(typeof(Enumerable), "Any", elementType.AsArray(), source);
+ ? Expression.Call(typeof(Enumerable), "Any", [elementType], source, predicate)
+ : Expression.Call(typeof(Enumerable), "Any", [elementType], source);
}
public override Expression VisitIsType(IsTypeExpression expression, QueryClauseBuilderContext context)
@@ -100,17 +100,12 @@ public override Expression VisitMatchText(MatchTextExpression expression, QueryC
Expression text = Visit(expression.TextValue, context);
- if (expression.MatchKind == TextMatchKind.StartsWith)
+ return expression.MatchKind switch
{
- return Expression.Call(property, "StartsWith", null, text);
- }
-
- if (expression.MatchKind == TextMatchKind.EndsWith)
- {
- return Expression.Call(property, "EndsWith", null, text);
- }
-
- return Expression.Call(property, "Contains", null, text);
+ TextMatchKind.StartsWith => Expression.Call(property, "StartsWith", null, text),
+ TextMatchKind.EndsWith => Expression.Call(property, "EndsWith", null, text),
+ _ => Expression.Call(property, "Contains", null, text)
+ };
}
public override Expression VisitAny(AnyExpression expression, QueryClauseBuilderContext context)
@@ -130,24 +125,19 @@ public override Expression VisitAny(AnyExpression expression, QueryClauseBuilder
private static Expression ContainsExtensionMethodCall(Expression collection, Expression value)
{
- return Expression.Call(typeof(Enumerable), "Contains", value.Type.AsArray(), collection, value);
+ return Expression.Call(typeof(Enumerable), "Contains", [value.Type], collection, value);
}
public override Expression VisitLogical(LogicalExpression expression, QueryClauseBuilderContext context)
{
var termQueue = new Queue(expression.Terms.Select(filter => Visit(filter, context)));
- if (expression.Operator == LogicalOperator.And)
- {
- return Compose(termQueue, Expression.AndAlso);
- }
-
- if (expression.Operator == LogicalOperator.Or)
+ return expression.Operator switch
{
- return Compose(termQueue, Expression.OrElse);
- }
-
- throw new InvalidOperationException($"Unknown logical operator '{expression.Operator}'.");
+ LogicalOperator.And => Compose(termQueue, Expression.AndAlso),
+ LogicalOperator.Or => Compose(termQueue, Expression.OrElse),
+ _ => throw new InvalidOperationException($"Unknown logical operator '{expression.Operator}'.")
+ };
}
private static BinaryExpression Compose(Queue argumentQueue, Func applyOperator)
diff --git a/src/JsonApiDotNetCore/QueryStrings/FieldChains/MatchState.cs b/src/JsonApiDotNetCore/QueryStrings/FieldChains/MatchState.cs
index 90255191d7..a0aa58e377 100644
--- a/src/JsonApiDotNetCore/QueryStrings/FieldChains/MatchState.cs
+++ b/src/JsonApiDotNetCore/QueryStrings/FieldChains/MatchState.cs
@@ -245,7 +245,7 @@ public IReadOnlyList GetAllFieldsMatched()
current = current._parentMatch;
}
- List fields = new();
+ List fields = [];
while (matchStack.Count > 0)
{
diff --git a/src/JsonApiDotNetCore/QueryStrings/FieldChains/MatchTraceScope.cs b/src/JsonApiDotNetCore/QueryStrings/FieldChains/MatchTraceScope.cs
index 63c6c67876..653c029e46 100644
--- a/src/JsonApiDotNetCore/QueryStrings/FieldChains/MatchTraceScope.cs
+++ b/src/JsonApiDotNetCore/QueryStrings/FieldChains/MatchTraceScope.cs
@@ -69,7 +69,7 @@ public void LogMatchResult(MatchState resultState)
}
else
{
- List chain = new(resultState.FieldsMatched.Select(attribute => attribute.PublicName));
+ List chain = [..resultState.FieldsMatched.Select(attribute => attribute.PublicName)];
if (resultState.FieldsRemaining != null)
{
diff --git a/src/JsonApiDotNetCore/QueryStrings/FieldChains/PatternMatcher.cs b/src/JsonApiDotNetCore/QueryStrings/FieldChains/PatternMatcher.cs
index 8172bdaa95..049aac2b94 100644
--- a/src/JsonApiDotNetCore/QueryStrings/FieldChains/PatternMatcher.cs
+++ b/src/JsonApiDotNetCore/QueryStrings/FieldChains/PatternMatcher.cs
@@ -186,7 +186,7 @@ private MatchState MatchField(MatchState state)
///
private HashSet LookupFields(ResourceType? resourceType, string publicName)
{
- HashSet fields = new();
+ HashSet fields = [];
if (resourceType != null)
{
diff --git a/src/JsonApiDotNetCore/QueryStrings/FieldChains/PatternParser.cs b/src/JsonApiDotNetCore/QueryStrings/FieldChains/PatternParser.cs
index a00ec26846..cc0fa0a69e 100644
--- a/src/JsonApiDotNetCore/QueryStrings/FieldChains/PatternParser.cs
+++ b/src/JsonApiDotNetCore/QueryStrings/FieldChains/PatternParser.cs
@@ -28,12 +28,12 @@ internal sealed class PatternParser
[Token.Field] = FieldTypes.Field
};
- private static readonly HashSet QuantifierTokens = new(new[]
- {
+ private static readonly HashSet QuantifierTokens =
+ [
Token.QuestionMark,
Token.Plus,
Token.Asterisk
- });
+ ];
private string _source = null!;
private Queue _tokenQueue = null!;
diff --git a/src/JsonApiDotNetCore/QueryStrings/FilterQueryStringParameterReader.cs b/src/JsonApiDotNetCore/QueryStrings/FilterQueryStringParameterReader.cs
index fe8d35bdca..6ebdd4fd29 100644
--- a/src/JsonApiDotNetCore/QueryStrings/FilterQueryStringParameterReader.cs
+++ b/src/JsonApiDotNetCore/QueryStrings/FilterQueryStringParameterReader.cs
@@ -22,7 +22,7 @@ public class FilterQueryStringParameterReader : QueryStringParameterReader, IFil
private readonly IQueryStringParameterScopeParser _scopeParser;
private readonly IFilterParser _filterParser;
private readonly ImmutableArray.Builder _filtersInGlobalScope = ImmutableArray.CreateBuilder();
- private readonly Dictionary.Builder> _filtersPerScope = new();
+ private readonly Dictionary.Builder> _filtersPerScope = [];
public bool AllowEmptyValue => false;
@@ -52,7 +52,7 @@ public virtual bool CanRead(string parameterName)
{
ArgumentGuard.NotNullNorEmpty(parameterName);
- bool isNested = parameterName.StartsWith("filter[", StringComparison.Ordinal) && parameterName.EndsWith("]", StringComparison.Ordinal);
+ bool isNested = parameterName.StartsWith("filter[", StringComparison.Ordinal) && parameterName.EndsWith(']');
return parameterName == "filter" || isNested;
}
diff --git a/src/JsonApiDotNetCore/QueryStrings/IFilterQueryStringParameterReader.cs b/src/JsonApiDotNetCore/QueryStrings/IFilterQueryStringParameterReader.cs
index b9a7fb8c6b..4fdefe2124 100644
--- a/src/JsonApiDotNetCore/QueryStrings/IFilterQueryStringParameterReader.cs
+++ b/src/JsonApiDotNetCore/QueryStrings/IFilterQueryStringParameterReader.cs
@@ -7,6 +7,4 @@ namespace JsonApiDotNetCore.QueryStrings;
/// Reads the 'filter' query string parameter and produces a set of query constraints from it.
///
[PublicAPI]
-public interface IFilterQueryStringParameterReader : IQueryStringParameterReader, IQueryConstraintProvider
-{
-}
+public interface IFilterQueryStringParameterReader : IQueryStringParameterReader, IQueryConstraintProvider;
diff --git a/src/JsonApiDotNetCore/QueryStrings/IIncludeQueryStringParameterReader.cs b/src/JsonApiDotNetCore/QueryStrings/IIncludeQueryStringParameterReader.cs
index 1993d249fc..822df2ee68 100644
--- a/src/JsonApiDotNetCore/QueryStrings/IIncludeQueryStringParameterReader.cs
+++ b/src/JsonApiDotNetCore/QueryStrings/IIncludeQueryStringParameterReader.cs
@@ -7,6 +7,4 @@ namespace JsonApiDotNetCore.QueryStrings;
/// Reads the 'include' query string parameter and produces a set of query constraints from it.
///
[PublicAPI]
-public interface IIncludeQueryStringParameterReader : IQueryStringParameterReader, IQueryConstraintProvider
-{
-}
+public interface IIncludeQueryStringParameterReader : IQueryStringParameterReader, IQueryConstraintProvider;
diff --git a/src/JsonApiDotNetCore/QueryStrings/IPaginationQueryStringParameterReader.cs b/src/JsonApiDotNetCore/QueryStrings/IPaginationQueryStringParameterReader.cs
index 198bff6ff8..56141e5615 100644
--- a/src/JsonApiDotNetCore/QueryStrings/IPaginationQueryStringParameterReader.cs
+++ b/src/JsonApiDotNetCore/QueryStrings/IPaginationQueryStringParameterReader.cs
@@ -7,6 +7,4 @@ namespace JsonApiDotNetCore.QueryStrings;
/// Reads the 'page' query string parameter and produces a set of query constraints from it.
///
[PublicAPI]
-public interface IPaginationQueryStringParameterReader : IQueryStringParameterReader, IQueryConstraintProvider
-{
-}
+public interface IPaginationQueryStringParameterReader : IQueryStringParameterReader, IQueryConstraintProvider;
diff --git a/src/JsonApiDotNetCore/QueryStrings/IResourceDefinitionQueryableParameterReader.cs b/src/JsonApiDotNetCore/QueryStrings/IResourceDefinitionQueryableParameterReader.cs
index 9ef114e4b3..965eb2d884 100644
--- a/src/JsonApiDotNetCore/QueryStrings/IResourceDefinitionQueryableParameterReader.cs
+++ b/src/JsonApiDotNetCore/QueryStrings/IResourceDefinitionQueryableParameterReader.cs
@@ -9,6 +9,4 @@ namespace JsonApiDotNetCore.QueryStrings;
/// query constraints from it.
///
[PublicAPI]
-public interface IResourceDefinitionQueryableParameterReader : IQueryStringParameterReader, IQueryConstraintProvider
-{
-}
+public interface IResourceDefinitionQueryableParameterReader : IQueryStringParameterReader, IQueryConstraintProvider;
diff --git a/src/JsonApiDotNetCore/QueryStrings/ISortQueryStringParameterReader.cs b/src/JsonApiDotNetCore/QueryStrings/ISortQueryStringParameterReader.cs
index 5cb221a399..763d1a67f1 100644
--- a/src/JsonApiDotNetCore/QueryStrings/ISortQueryStringParameterReader.cs
+++ b/src/JsonApiDotNetCore/QueryStrings/ISortQueryStringParameterReader.cs
@@ -7,6 +7,4 @@ namespace JsonApiDotNetCore.QueryStrings;
/// Reads the 'sort' query string parameter and produces a set of query constraints from it.
///
[PublicAPI]
-public interface ISortQueryStringParameterReader : IQueryStringParameterReader, IQueryConstraintProvider
-{
-}
+public interface ISortQueryStringParameterReader : IQueryStringParameterReader, IQueryConstraintProvider;
diff --git a/src/JsonApiDotNetCore/QueryStrings/ISparseFieldSetQueryStringParameterReader.cs b/src/JsonApiDotNetCore/QueryStrings/ISparseFieldSetQueryStringParameterReader.cs
index e943121ecc..1f0bdaf90f 100644
--- a/src/JsonApiDotNetCore/QueryStrings/ISparseFieldSetQueryStringParameterReader.cs
+++ b/src/JsonApiDotNetCore/QueryStrings/ISparseFieldSetQueryStringParameterReader.cs
@@ -7,6 +7,4 @@ namespace JsonApiDotNetCore.QueryStrings;
/// Reads the 'fields' query string parameter and produces a set of query constraints from it.
///
[PublicAPI]
-public interface ISparseFieldSetQueryStringParameterReader : IQueryStringParameterReader, IQueryConstraintProvider
-{
-}
+public interface ISparseFieldSetQueryStringParameterReader : IQueryStringParameterReader, IQueryConstraintProvider;
diff --git a/src/JsonApiDotNetCore/QueryStrings/IncludeQueryStringParameterReader.cs b/src/JsonApiDotNetCore/QueryStrings/IncludeQueryStringParameterReader.cs
index de144de7c5..76bcc4a7b4 100644
--- a/src/JsonApiDotNetCore/QueryStrings/IncludeQueryStringParameterReader.cs
+++ b/src/JsonApiDotNetCore/QueryStrings/IncludeQueryStringParameterReader.cs
@@ -72,6 +72,6 @@ public virtual IReadOnlyCollection GetConstraints()
? new ExpressionInScope(null, _includeExpression)
: new ExpressionInScope(null, IncludeExpression.Empty);
- return expressionInScope.AsArray();
+ return [expressionInScope];
}
}
diff --git a/src/JsonApiDotNetCore/QueryStrings/PaginationQueryStringParameterReader.cs b/src/JsonApiDotNetCore/QueryStrings/PaginationQueryStringParameterReader.cs
index 93e180275a..3364217efb 100644
--- a/src/JsonApiDotNetCore/QueryStrings/PaginationQueryStringParameterReader.cs
+++ b/src/JsonApiDotNetCore/QueryStrings/PaginationQueryStringParameterReader.cs
@@ -165,7 +165,7 @@ public virtual IReadOnlyCollection GetConstraints()
private sealed class PaginationState
{
private readonly MutablePaginationEntry _globalScope = new();
- private readonly Dictionary _nestedScopes = new();
+ private readonly Dictionary _nestedScopes = [];
public MutablePaginationEntry ResolveEntryInScope(ResourceFieldChainExpression? scope)
{
diff --git a/src/JsonApiDotNetCore/QueryStrings/ResourceDefinitionQueryableParameterReader.cs b/src/JsonApiDotNetCore/QueryStrings/ResourceDefinitionQueryableParameterReader.cs
index c881f04dc4..3d844e4b48 100644
--- a/src/JsonApiDotNetCore/QueryStrings/ResourceDefinitionQueryableParameterReader.cs
+++ b/src/JsonApiDotNetCore/QueryStrings/ResourceDefinitionQueryableParameterReader.cs
@@ -15,7 +15,7 @@ public class ResourceDefinitionQueryableParameterReader : IResourceDefinitionQue
{
private readonly IJsonApiRequest _request;
private readonly IResourceDefinitionAccessor _resourceDefinitionAccessor;
- private readonly List _constraints = new();
+ private readonly List _constraints = [];
public bool AllowEmptyValue => false;
diff --git a/src/JsonApiDotNetCore/QueryStrings/SortQueryStringParameterReader.cs b/src/JsonApiDotNetCore/QueryStrings/SortQueryStringParameterReader.cs
index 542d69b8ec..d068ae7ce2 100644
--- a/src/JsonApiDotNetCore/QueryStrings/SortQueryStringParameterReader.cs
+++ b/src/JsonApiDotNetCore/QueryStrings/SortQueryStringParameterReader.cs
@@ -17,7 +17,7 @@ public class SortQueryStringParameterReader : QueryStringParameterReader, ISortQ
{
private readonly IQueryStringParameterScopeParser _scopeParser;
private readonly ISortParser _sortParser;
- private readonly List _constraints = new();
+ private readonly List _constraints = [];
public bool AllowEmptyValue => false;
@@ -45,7 +45,7 @@ public virtual bool CanRead(string parameterName)
{
ArgumentGuard.NotNullNorEmpty(parameterName);
- bool isNested = parameterName.StartsWith("sort[", StringComparison.Ordinal) && parameterName.EndsWith("]", StringComparison.Ordinal);
+ bool isNested = parameterName.StartsWith("sort[", StringComparison.Ordinal) && parameterName.EndsWith(']');
return parameterName == "sort" || isNested;
}
diff --git a/src/JsonApiDotNetCore/QueryStrings/SparseFieldSetQueryStringParameterReader.cs b/src/JsonApiDotNetCore/QueryStrings/SparseFieldSetQueryStringParameterReader.cs
index 9757383c39..559da09f38 100644
--- a/src/JsonApiDotNetCore/QueryStrings/SparseFieldSetQueryStringParameterReader.cs
+++ b/src/JsonApiDotNetCore/QueryStrings/SparseFieldSetQueryStringParameterReader.cs
@@ -50,7 +50,7 @@ public virtual bool CanRead(string parameterName)
{
ArgumentGuard.NotNullNorEmpty(parameterName);
- return parameterName.StartsWith("fields[", StringComparison.Ordinal) && parameterName.EndsWith("]", StringComparison.Ordinal);
+ return parameterName.StartsWith("fields[", StringComparison.Ordinal) && parameterName.EndsWith(']');
}
///
@@ -100,7 +100,7 @@ private SparseFieldSetExpression GetSparseFieldSet(string parameterValue, Resour
public virtual IReadOnlyCollection GetConstraints()
{
return _sparseFieldTableBuilder.Any()
- ? new ExpressionInScope(null, new SparseFieldTableExpression(_sparseFieldTableBuilder.ToImmutable())).AsArray()
+ ? [new ExpressionInScope(null, new SparseFieldTableExpression(_sparseFieldTableBuilder.ToImmutable()))]
: Array.Empty();
}
}
diff --git a/src/JsonApiDotNetCore/Repositories/IResourceRepository.cs b/src/JsonApiDotNetCore/Repositories/IResourceRepository.cs
index 26b7c4513e..218a09cb93 100644
--- a/src/JsonApiDotNetCore/Repositories/IResourceRepository.cs
+++ b/src/JsonApiDotNetCore/Repositories/IResourceRepository.cs
@@ -14,6 +14,4 @@ namespace JsonApiDotNetCore.Repositories;
///
[PublicAPI]
public interface IResourceRepository : IResourceReadRepository, IResourceWriteRepository
- where TResource : class, IIdentifiable
-{
-}
+ where TResource : class, IIdentifiable;
diff --git a/src/JsonApiDotNetCore/Resources/JsonApiResourceDefinition.cs b/src/JsonApiDotNetCore/Resources/JsonApiResourceDefinition.cs
index f6653b9bdb..f069c155e8 100644
--- a/src/JsonApiDotNetCore/Resources/JsonApiResourceDefinition.cs
+++ b/src/JsonApiDotNetCore/Resources/JsonApiResourceDefinition.cs
@@ -177,7 +177,5 @@ public virtual void OnSerialize(TResource resource)
/// This is an alias type intended to simplify the implementation's method signature. See for usage
/// details.
///
- public sealed class PropertySortOrder : List<(Expression> KeySelector, ListSortDirection SortDirection)>
- {
- }
+ public sealed class PropertySortOrder : List<(Expression> KeySelector, ListSortDirection SortDirection)>;
}
diff --git a/src/JsonApiDotNetCore/Resources/QueryStringParameterHandlers.cs b/src/JsonApiDotNetCore/Resources/QueryStringParameterHandlers.cs
index 52c9f7d71a..b48c46e26e 100644
--- a/src/JsonApiDotNetCore/Resources/QueryStringParameterHandlers.cs
+++ b/src/JsonApiDotNetCore/Resources/QueryStringParameterHandlers.cs
@@ -6,6 +6,4 @@ namespace JsonApiDotNetCore.Resources;
/// This is an alias type intended to simplify the implementation's method signature. See
/// for usage details.
///
-public sealed class QueryStringParameterHandlers : Dictionary, StringValues, IQueryable>>
-{
-}
+public sealed class QueryStringParameterHandlers : Dictionary, StringValues, IQueryable>>;
diff --git a/src/JsonApiDotNetCore/Resources/ResourceFactory.cs b/src/JsonApiDotNetCore/Resources/ResourceFactory.cs
index b803544bec..9d282b4938 100644
--- a/src/JsonApiDotNetCore/Resources/ResourceFactory.cs
+++ b/src/JsonApiDotNetCore/Resources/ResourceFactory.cs
@@ -50,7 +50,7 @@ private static IIdentifiable CreateWrapperForAbstractType(Type resourceClrType)
Type wrapperClrType = typeof(AbstractResourceWrapper<>).MakeGenericType(descriptor.IdClrType);
ConstructorInfo constructor = wrapperClrType.GetConstructors().Single();
- object resource = constructor.Invoke(ArrayFactory.Create(resourceClrType));
+ object resource = constructor.Invoke([resourceClrType]);
return (IIdentifiable)resource;
}
diff --git a/src/JsonApiDotNetCore/Resources/TargetedFields.cs b/src/JsonApiDotNetCore/Resources/TargetedFields.cs
index cb3a0874e0..2e841873b2 100644
--- a/src/JsonApiDotNetCore/Resources/TargetedFields.cs
+++ b/src/JsonApiDotNetCore/Resources/TargetedFields.cs
@@ -10,8 +10,8 @@ public sealed class TargetedFields : ITargetedFields
IReadOnlySet ITargetedFields.Attributes => Attributes;
IReadOnlySet ITargetedFields.Relationships => Relationships;
- public HashSet Attributes { get; } = new();
- public HashSet Relationships { get; } = new();
+ public HashSet Attributes { get; } = [];
+ public HashSet Relationships { get; } = [];
///
public void CopyFrom(ITargetedFields other)
diff --git a/src/JsonApiDotNetCore/Serialization/Response/ETagGenerator.cs b/src/JsonApiDotNetCore/Serialization/Response/ETagGenerator.cs
index 7a22cf5a60..d5aefb1fee 100644
--- a/src/JsonApiDotNetCore/Serialization/Response/ETagGenerator.cs
+++ b/src/JsonApiDotNetCore/Serialization/Response/ETagGenerator.cs
@@ -17,7 +17,13 @@ public ETagGenerator(IFingerprintGenerator fingerprintGenerator)
///
public EntityTagHeaderValue Generate(string requestUrl, string responseBody)
{
- string fingerprint = _fingerprintGenerator.Generate(ArrayFactory.Create(requestUrl, responseBody));
+ string[] elements =
+ [
+ requestUrl,
+ responseBody
+ ];
+
+ string fingerprint = _fingerprintGenerator.Generate(elements);
string eTagValue = $"\"{fingerprint}\"";
return EntityTagHeaderValue.Parse(eTagValue);
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/src/JsonApiDotNetCore/Serialization/Response/JsonApiWriter.cs b/src/JsonApiDotNetCore/Serialization/Response/JsonApiWriter.cs
index 22de5284a2..8ea0d060e2 100644
--- a/src/JsonApiDotNetCore/Serialization/Response/JsonApiWriter.cs
+++ b/src/JsonApiDotNetCore/Serialization/Response/JsonApiWriter.cs
@@ -44,14 +44,14 @@ public JsonApiWriter(IJsonApiRequest request, IJsonApiOptions options, IResponse
}
///
- public async Task WriteAsync(object? model, HttpContext httpContext)
+ public Task WriteAsync(object? model, HttpContext httpContext)
{
ArgumentGuard.NotNull(httpContext);
if (model == null && !CanWriteBody((HttpStatusCode)httpContext.Response.StatusCode))
{
// Prevent exception from Kestrel server, caused by writing data:null json response.
- return;
+ return Task.CompletedTask;
}
string? responseBody = GetResponseBody(model, httpContext);
@@ -59,7 +59,7 @@ public async Task WriteAsync(object? model, HttpContext httpContext)
if (httpContext.Request.Method == HttpMethod.Head.Method)
{
httpContext.Response.GetTypedHeaders().ContentLength = responseBody == null ? 0 : Encoding.UTF8.GetByteCount(responseBody);
- return;
+ return Task.CompletedTask;
}
_traceWriter.LogMessage(() =>
@@ -70,7 +70,7 @@ public async Task WriteAsync(object? model, HttpContext httpContext)
return $"Sending {httpContext.Response.StatusCode} response for {method} request at '{url}' with body: <<{responseBody}>>";
});
- await SendResponseBodyAsync(httpContext.Response, responseBody);
+ return SendResponseBodyAsync(httpContext.Response, responseBody);
}
private static bool CanWriteBody(HttpStatusCode statusCode)
diff --git a/src/JsonApiDotNetCore/Serialization/Response/MetaBuilder.cs b/src/JsonApiDotNetCore/Serialization/Response/MetaBuilder.cs
index 3d1eb5dd26..a5e647c853 100644
--- a/src/JsonApiDotNetCore/Serialization/Response/MetaBuilder.cs
+++ b/src/JsonApiDotNetCore/Serialization/Response/MetaBuilder.cs
@@ -12,7 +12,7 @@ public sealed class MetaBuilder : IMetaBuilder
private readonly IJsonApiOptions _options;
private readonly IResponseMeta _responseMeta;
- private Dictionary _meta = new();
+ private Dictionary _meta = [];
public MetaBuilder(IPaginationContext paginationContext, IJsonApiOptions options, IResponseMeta responseMeta)
{
diff --git a/src/JsonApiDotNetCore/Serialization/Response/ResourceObjectTreeNode.cs b/src/JsonApiDotNetCore/Serialization/Response/ResourceObjectTreeNode.cs
index 901c1d94fc..ab50d6f674 100644
--- a/src/JsonApiDotNetCore/Serialization/Response/ResourceObjectTreeNode.cs
+++ b/src/JsonApiDotNetCore/Serialization/Response/ResourceObjectTreeNode.cs
@@ -55,7 +55,7 @@ public void AttachDirectChild(ResourceObjectTreeNode treeNode)
{
ArgumentGuard.NotNull(treeNode);
- _directChildren ??= new List();
+ _directChildren ??= [];
_directChildren.Add(treeNode);
}
@@ -63,11 +63,11 @@ public void EnsureHasRelationship(RelationshipAttribute relationship)
{
ArgumentGuard.NotNull(relationship);
- _childrenByRelationship ??= new Dictionary>();
+ _childrenByRelationship ??= [];
if (!_childrenByRelationship.ContainsKey(relationship))
{
- _childrenByRelationship[relationship] = new HashSet();
+ _childrenByRelationship[relationship] = [];
}
}
@@ -182,7 +182,7 @@ public IList GetResponseIncluded()
}
ISet primaryResourceObjectSet = GetDirectChildren().Select(node => node.ResourceObject).ToHashSet(ResourceObjectComparer.Instance);
- List includes = new();
+ List includes = [];
foreach (ResourceObject include in visited.Select(node => node.ResourceObject))
{
diff --git a/src/JsonApiDotNetCore/Serialization/Response/ResponseModelAdapter.cs b/src/JsonApiDotNetCore/Serialization/Response/ResponseModelAdapter.cs
index 4bd6844335..9457b05502 100644
--- a/src/JsonApiDotNetCore/Serialization/Response/ResponseModelAdapter.cs
+++ b/src/JsonApiDotNetCore/Serialization/Response/ResponseModelAdapter.cs
@@ -107,7 +107,7 @@ public Document Convert(object? model)
}
else if (model is ErrorObject errorObject)
{
- document.Errors = errorObject.AsArray();
+ document.Errors = [errorObject];
}
else
{
diff --git a/src/JsonApiDotNetCore/Services/IResourceCommandService.cs b/src/JsonApiDotNetCore/Services/IResourceCommandService.cs
index 6c6dc408c9..7bc47b6c20 100644
--- a/src/JsonApiDotNetCore/Services/IResourceCommandService.cs
+++ b/src/JsonApiDotNetCore/Services/IResourceCommandService.cs
@@ -14,6 +14,4 @@ namespace JsonApiDotNetCore.Services;
public interface IResourceCommandService
: ICreateService, IAddToRelationshipService, IUpdateService, ISetRelationshipService,
IDeleteService, IRemoveFromRelationshipService
- where TResource : class, IIdentifiable
-{
-}
+ where TResource : class, IIdentifiable;
diff --git a/src/JsonApiDotNetCore/Services/IResourceQueryService.cs b/src/JsonApiDotNetCore/Services/IResourceQueryService.cs
index 7c9d32071f..b2de9b03fc 100644
--- a/src/JsonApiDotNetCore/Services/IResourceQueryService.cs
+++ b/src/JsonApiDotNetCore/Services/IResourceQueryService.cs
@@ -13,6 +13,4 @@ namespace JsonApiDotNetCore.Services;
///
public interface IResourceQueryService
: IGetAllService, IGetByIdService, IGetRelationshipService, IGetSecondaryService
- where TResource : class, IIdentifiable
-{
-}
+ where TResource : class, IIdentifiable;
diff --git a/src/JsonApiDotNetCore/Services/IResourceService.cs b/src/JsonApiDotNetCore/Services/IResourceService.cs
index 87637e53a2..2a75be7151 100644
--- a/src/JsonApiDotNetCore/Services/IResourceService.cs
+++ b/src/JsonApiDotNetCore/Services/IResourceService.cs
@@ -12,6 +12,4 @@ namespace JsonApiDotNetCore.Services;
/// The resource identifier type.
///
public interface IResourceService : IResourceCommandService, IResourceQueryService
- where TResource : class, IIdentifiable
-{
-}
+ where TResource : class, IIdentifiable;
diff --git a/src/JsonApiDotNetCore/Services/JsonApiResourceService.cs b/src/JsonApiDotNetCore/Services/JsonApiResourceService.cs
index 5984b6215b..c9a19ff73d 100644
--- a/src/JsonApiDotNetCore/Services/JsonApiResourceService.cs
+++ b/src/JsonApiDotNetCore/Services/JsonApiResourceService.cs
@@ -244,19 +244,19 @@ protected async Task AssertPrimaryResourceDoesNotExistAsync(TResource resource,
}
}
- protected virtual async Task InitializeResourceAsync(TResource resourceForDatabase, CancellationToken cancellationToken)
+ protected virtual Task InitializeResourceAsync(TResource resourceForDatabase, CancellationToken cancellationToken)
{
- await _resourceDefinitionAccessor.OnPrepareWriteAsync(resourceForDatabase, WriteOperationKind.CreateResource, cancellationToken);
+ return _resourceDefinitionAccessor.OnPrepareWriteAsync(resourceForDatabase, WriteOperationKind.CreateResource, cancellationToken);
}
- private async Task AccurizeResourceTypesInHierarchyToAssignInRelationshipsAsync(TResource primaryResource, CancellationToken cancellationToken)
+ private Task AccurizeResourceTypesInHierarchyToAssignInRelationshipsAsync(TResource primaryResource, CancellationToken cancellationToken)
{
- await ValidateResourcesToAssignInRelationshipsExistWithRefreshAsync(primaryResource, true, cancellationToken);
+ return ValidateResourcesToAssignInRelationshipsExistWithRefreshAsync(primaryResource, true, cancellationToken);
}
- protected async Task AssertResourcesToAssignInRelationshipsExistAsync(TResource primaryResource, CancellationToken cancellationToken)
+ protected Task AssertResourcesToAssignInRelationshipsExistAsync(TResource primaryResource, CancellationToken cancellationToken)
{
- await ValidateResourcesToAssignInRelationshipsExistWithRefreshAsync(primaryResource, false, cancellationToken);
+ return ValidateResourcesToAssignInRelationshipsExistWithRefreshAsync(primaryResource, false, cancellationToken);
}
private async Task ValidateResourcesToAssignInRelationshipsExistWithRefreshAsync(TResource primaryResource, bool onlyIfTypeHierarchy,
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/AtomicOperations/AtomicOperationsTests.cs b/test/DapperTests/IntegrationTests/AtomicOperations/AtomicOperationsTests.cs
index 194d55d837..286820b702 100644
--- a/test/DapperTests/IntegrationTests/AtomicOperations/AtomicOperationsTests.cs
+++ b/test/DapperTests/IntegrationTests/AtomicOperations/AtomicOperationsTests.cs
@@ -214,9 +214,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[0].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"INSERT INTO ""People"" (""FirstName"", ""LastName"", ""AccountId"")
-VALUES (@p1, @p2, @p3)
-RETURNING ""Id"""));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ INSERT INTO "People" ("FirstName", "LastName", "AccountId")
+ VALUES (@p1, @p2, @p3)
+ RETURNING "Id"
+ """));
command.Parameters.ShouldHaveCount(3);
command.Parameters.Should().Contain("@p1", newOwner.FirstName);
@@ -226,9 +228,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[1].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"SELECT t1.""Id"", t1.""FirstName"", t1.""LastName""
-FROM ""People"" AS t1
-WHERE t1.""Id"" = @p1"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id", t1."FirstName", t1."LastName"
+ FROM "People" AS t1
+ WHERE t1."Id" = @p1
+ """));
command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().Contain("@p1", newOwnerId);
@@ -236,9 +240,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[2].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"INSERT INTO ""People"" (""FirstName"", ""LastName"", ""AccountId"")
-VALUES (@p1, @p2, @p3)
-RETURNING ""Id"""));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ INSERT INTO "People" ("FirstName", "LastName", "AccountId")
+ VALUES (@p1, @p2, @p3)
+ RETURNING "Id"
+ """));
command.Parameters.ShouldHaveCount(3);
command.Parameters.Should().Contain("@p1", newAssignee.FirstName);
@@ -248,9 +254,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[3].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"SELECT t1.""Id"", t1.""FirstName"", t1.""LastName""
-FROM ""People"" AS t1
-WHERE t1.""Id"" = @p1"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id", t1."FirstName", t1."LastName"
+ FROM "People" AS t1
+ WHERE t1."Id" = @p1
+ """));
command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().Contain("@p1", newAssigneeId);
@@ -258,9 +266,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[4].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"INSERT INTO ""Tags"" (""Name"", ""TodoItemId"")
-VALUES (@p1, @p2)
-RETURNING ""Id"""));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ INSERT INTO "Tags" ("Name", "TodoItemId")
+ VALUES (@p1, @p2)
+ RETURNING "Id"
+ """));
command.Parameters.ShouldHaveCount(2);
command.Parameters.Should().Contain("@p1", newTag.Name);
@@ -269,9 +279,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[5].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"SELECT t1.""Id"", t1.""Name""
-FROM ""Tags"" AS t1
-WHERE t1.""Id"" = @p1"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id", t1."Name"
+ FROM "Tags" AS t1
+ WHERE t1."Id" = @p1
+ """));
command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().Contain("@p1", newTagId);
@@ -279,10 +291,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[6].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(
- @"INSERT INTO ""TodoItems"" (""Description"", ""Priority"", ""DurationInHours"", ""CreatedAt"", ""LastModifiedAt"", ""OwnerId"", ""AssigneeId"")
-VALUES (@p1, @p2, @p3, @p4, @p5, @p6, @p7)
-RETURNING ""Id"""));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ INSERT INTO "TodoItems" ("Description", "Priority", "DurationInHours", "CreatedAt", "LastModifiedAt", "OwnerId", "AssigneeId")
+ VALUES (@p1, @p2, @p3, @p4, @p5, @p6, @p7)
+ RETURNING "Id"
+ """));
command.Parameters.ShouldHaveCount(7);
command.Parameters.Should().Contain("@p1", newTodoItem.Description);
@@ -296,10 +309,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[7].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(
- @"SELECT t1.""Id"", t1.""CreatedAt"", t1.""Description"", t1.""DurationInHours"", t1.""LastModifiedAt"", t1.""Priority""
-FROM ""TodoItems"" AS t1
-WHERE t1.""Id"" = @p1"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id", t1."CreatedAt", t1."Description", t1."DurationInHours", t1."LastModifiedAt", t1."Priority"
+ FROM "TodoItems" AS t1
+ WHERE t1."Id" = @p1
+ """));
command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().Contain("@p1", newTodoItemId);
@@ -307,11 +321,12 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[8].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(
- @"SELECT t1.""Id"", t1.""CreatedAt"", t1.""Description"", t1.""DurationInHours"", t1.""LastModifiedAt"", t1.""Priority"", t2.""Id"", t2.""FirstName"", t2.""LastName""
-FROM ""TodoItems"" AS t1
-LEFT JOIN ""People"" AS t2 ON t1.""AssigneeId"" = t2.""Id""
-WHERE t1.""Id"" = @p1"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id", t1."CreatedAt", t1."Description", t1."DurationInHours", t1."LastModifiedAt", t1."Priority", t2."Id", t2."FirstName", t2."LastName"
+ FROM "TodoItems" AS t1
+ LEFT JOIN "People" AS t2 ON t1."AssigneeId" = t2."Id"
+ WHERE t1."Id" = @p1
+ """));
command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().Contain("@p1", newTodoItemId);
@@ -319,9 +334,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[9].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"UPDATE ""TodoItems""
-SET ""AssigneeId"" = @p1
-WHERE ""Id"" = @p2"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ UPDATE "TodoItems"
+ SET "AssigneeId" = @p1
+ WHERE "Id" = @p2
+ """));
command.Parameters.ShouldHaveCount(2);
command.Parameters.Should().Contain("@p1", newAssigneeId);
@@ -330,11 +347,12 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[10].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(
- @"SELECT t1.""Id"", t1.""CreatedAt"", t1.""Description"", t1.""DurationInHours"", t1.""LastModifiedAt"", t1.""Priority"", t2.""Id"", t2.""Name""
-FROM ""TodoItems"" AS t1
-LEFT JOIN ""Tags"" AS t2 ON t1.""Id"" = t2.""TodoItemId""
-WHERE t1.""Id"" = @p1"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id", t1."CreatedAt", t1."Description", t1."DurationInHours", t1."LastModifiedAt", t1."Priority", t2."Id", t2."Name"
+ FROM "TodoItems" AS t1
+ LEFT JOIN "Tags" AS t2 ON t1."Id" = t2."TodoItemId"
+ WHERE t1."Id" = @p1
+ """));
command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().Contain("@p1", newTodoItemId);
@@ -342,9 +360,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[11].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"UPDATE ""TodoItems""
-SET ""LastModifiedAt"" = @p1
-WHERE ""Id"" = @p2"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ UPDATE "TodoItems"
+ SET "LastModifiedAt" = @p1
+ WHERE "Id" = @p2
+ """));
command.Parameters.ShouldHaveCount(2);
command.Parameters.Should().Contain("@p1", DapperTestContext.FrozenTime);
@@ -353,9 +373,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[12].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"UPDATE ""Tags""
-SET ""TodoItemId"" = @p1
-WHERE ""Id"" = @p2"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ UPDATE "Tags"
+ SET "TodoItemId" = @p1
+ WHERE "Id" = @p2
+ """));
command.Parameters.ShouldHaveCount(2);
command.Parameters.Should().Contain("@p1", newTodoItemId);
@@ -364,10 +386,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[13].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(
- @"SELECT t1.""Id"", t1.""CreatedAt"", t1.""Description"", t1.""DurationInHours"", t1.""LastModifiedAt"", t1.""Priority""
-FROM ""TodoItems"" AS t1
-WHERE t1.""Id"" = @p1"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id", t1."CreatedAt", t1."Description", t1."DurationInHours", t1."LastModifiedAt", t1."Priority"
+ FROM "TodoItems" AS t1
+ WHERE t1."Id" = @p1
+ """));
command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().Contain("@p1", newTodoItemId);
@@ -375,8 +398,10 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[14].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"DELETE FROM ""People""
-WHERE ""Id"" = @p1"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ DELETE FROM "People"
+ WHERE "Id" = @p1
+ """));
command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().Contain("@p1", newAssigneeId);
@@ -396,10 +421,7 @@ public async Task Can_rollback_on_error()
const string personLocalId = "new-person";
- await _testContext.RunOnDatabaseAsync(async dbContext =>
- {
- await _testContext.ClearAllTablesAsync(dbContext);
- });
+ await _testContext.RunOnDatabaseAsync(dbContext => _testContext.ClearAllTablesAsync(dbContext));
var requestBody = new
{
@@ -466,9 +488,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[0].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"INSERT INTO ""People"" (""FirstName"", ""LastName"", ""AccountId"")
-VALUES (@p1, @p2, @p3)
-RETURNING ""Id"""));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ INSERT INTO "People" ("FirstName", "LastName", "AccountId")
+ VALUES (@p1, @p2, @p3)
+ RETURNING "Id"
+ """));
command.Parameters.ShouldHaveCount(3);
command.Parameters.Should().Contain("@p1", null);
@@ -478,9 +502,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[1].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"SELECT t1.""Id"", t1.""FirstName"", t1.""LastName""
-FROM ""People"" AS t1
-WHERE t1.""Id"" = @p1"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id", t1."FirstName", t1."LastName"
+ FROM "People" AS t1
+ WHERE t1."Id" = @p1
+ """));
command.Parameters.ShouldHaveCount(1);
command.Parameters.ShouldContainKey("@p1").With(value => value.ShouldNotBeNull());
@@ -488,11 +514,12 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[2].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(
- @"SELECT t1.""Id"", t1.""FirstName"", t1.""LastName"", t2.""Id"", t2.""CreatedAt"", t2.""Description"", t2.""DurationInHours"", t2.""LastModifiedAt"", t2.""Priority""
-FROM ""People"" AS t1
-LEFT JOIN ""TodoItems"" AS t2 ON t1.""Id"" = t2.""AssigneeId""
-WHERE t1.""Id"" = @p1"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id", t1."FirstName", t1."LastName", t2."Id", t2."CreatedAt", t2."Description", t2."DurationInHours", t2."LastModifiedAt", t2."Priority"
+ FROM "People" AS t1
+ LEFT JOIN "TodoItems" AS t2 ON t1."Id" = t2."AssigneeId"
+ WHERE t1."Id" = @p1
+ """));
command.Parameters.ShouldHaveCount(1);
command.Parameters.ShouldContainKey("@p1").With(value => value.ShouldNotBeNull());
@@ -500,9 +527,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[3].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"UPDATE ""TodoItems""
-SET ""AssigneeId"" = @p1
-WHERE ""Id"" = @p2"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ UPDATE "TodoItems"
+ SET "AssigneeId" = @p1
+ WHERE "Id" = @p2
+ """));
command.Parameters.ShouldHaveCount(2);
command.Parameters.ShouldContainKey("@p1").With(value => value.ShouldNotBeNull());
@@ -511,9 +540,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[4].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"SELECT t1.""Id""
-FROM ""TodoItems"" AS t1
-WHERE t1.""Id"" = @p1"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id"
+ FROM "TodoItems" AS t1
+ WHERE t1."Id" = @p1
+ """));
command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().Contain("@p1", unknownTodoItemId);
diff --git a/test/DapperTests/IntegrationTests/DapperTestContext.cs b/test/DapperTests/IntegrationTests/DapperTestContext.cs
index 084444e896..6bbcca6777 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,16 +16,18 @@
using Microsoft.Extensions.Logging;
using TestBuildingBlocks;
using Xunit.Abstractions;
+using IClock = DapperExample.IClock;
namespace DapperTests.IntegrationTests;
[PublicAPI]
public sealed class DapperTestContext : IntegrationTest
{
- private const string SqlServerClearAllTablesScript = @"
+ private const string SqlServerClearAllTablesScript = """
EXEC sp_MSForEachTable 'ALTER TABLE ? NOCHECK CONSTRAINT ALL';
EXEC sp_MSForEachTable 'SET QUOTED_IDENTIFIER ON; DELETE FROM ?';
- EXEC sp_MSForEachTable 'ALTER TABLE ? CHECK CONSTRAINT ALL';";
+ EXEC sp_MSForEachTable 'ALTER TABLE ? CHECK CONSTRAINT ALL';
+ """;
public static readonly DateTimeOffset FrozenTime = 29.September(2018).At(16, 41, 56).AsUtc().ToDateTimeOffset();
@@ -74,7 +75,7 @@ private WebApplicationFactory CreateFactory()
builder.ConfigureServices(services =>
{
- services.AddSingleton(new FrozenSystemClock
+ services.AddSingleton(new FrozenClock
{
UtcNow = FrozenTime
});
@@ -114,7 +115,10 @@ public async Task ClearAllTablesAsync(DbContext dbContext)
_ => throw new NotSupportedException($"Unsupported database provider '{databaseProvider}'.")
};
+#pragma warning disable EF1002 // Risk of vulnerability to SQL injection.
+ // Justification: Table names cannot be parameterized.
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/DapperTests/IntegrationTests/QueryStrings/FilterTests.cs b/test/DapperTests/IntegrationTests/QueryStrings/FilterTests.cs
index d23a90765a..56bfdd5a7c 100644
--- a/test/DapperTests/IntegrationTests/QueryStrings/FilterTests.cs
+++ b/test/DapperTests/IntegrationTests/QueryStrings/FilterTests.cs
@@ -60,10 +60,12 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[0].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"SELECT COUNT(*)
-FROM ""Tags"" AS t1
-LEFT JOIN ""RgbColors"" AS t2 ON t1.""Id"" = t2.""TagId""
-WHERE t2.""Id"" = @p1"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT COUNT(*)
+ FROM "Tags" AS t1
+ LEFT JOIN "RgbColors" AS t2 ON t1."Id" = t2."TagId"
+ WHERE t2."Id" = @p1
+ """));
command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().Contain("@p1", 0x00FF00);
@@ -71,11 +73,13 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[1].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"SELECT t1.""Id"", t1.""Name""
-FROM ""Tags"" AS t1
-LEFT JOIN ""RgbColors"" AS t2 ON t1.""Id"" = t2.""TagId""
-WHERE t2.""Id"" = @p1
-ORDER BY t1.""Id"""));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id", t1."Name"
+ FROM "Tags" AS t1
+ LEFT JOIN "RgbColors" AS t2 ON t1."Id" = t2."TagId"
+ WHERE t2."Id" = @p1
+ ORDER BY t1."Id"
+ """));
command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().Contain("@p1", 0x00FF00);
@@ -121,10 +125,12 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[0].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"SELECT COUNT(*)
-FROM ""Tags"" AS t1
-LEFT JOIN ""RgbColors"" AS t2 ON t1.""Id"" = t2.""TagId""
-WHERE t2.""Id"" IN (@p1, @p2)"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT COUNT(*)
+ FROM "Tags" AS t1
+ LEFT JOIN "RgbColors" AS t2 ON t1."Id" = t2."TagId"
+ WHERE t2."Id" IN (@p1, @p2)
+ """));
command.Parameters.ShouldHaveCount(2);
command.Parameters.Should().Contain("@p1", 0x00FF00);
@@ -133,11 +139,13 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[1].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"SELECT t1.""Id"", t1.""Name""
-FROM ""Tags"" AS t1
-LEFT JOIN ""RgbColors"" AS t2 ON t1.""Id"" = t2.""TagId""
-WHERE t2.""Id"" IN (@p1, @p2)
-ORDER BY t1.""Id"""));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id", t1."Name"
+ FROM "Tags" AS t1
+ LEFT JOIN "RgbColors" AS t2 ON t1."Id" = t2."TagId"
+ WHERE t2."Id" IN (@p1, @p2)
+ ORDER BY t1."Id"
+ """));
command.Parameters.ShouldHaveCount(2);
command.Parameters.Should().Contain("@p1", 0x00FF00);
@@ -180,11 +188,13 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[0].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"SELECT COUNT(*)
-FROM ""TodoItems"" AS t1
-INNER JOIN ""People"" AS t2 ON t1.""OwnerId"" = t2.""Id""
-LEFT JOIN ""People"" AS t3 ON t1.""AssigneeId"" = t3.""Id""
-WHERE (t2.""Id"" = @p1) AND (t3.""Id"" IS NULL)"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT COUNT(*)
+ FROM "TodoItems" AS t1
+ INNER JOIN "People" AS t2 ON t1."OwnerId" = t2."Id"
+ LEFT JOIN "People" AS t3 ON t1."AssigneeId" = t3."Id"
+ WHERE (t2."Id" = @p1) AND (t3."Id" IS NULL)
+ """));
command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().Contain("@p1", person.Id);
@@ -192,17 +202,18 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[1].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(
- @"SELECT t1.""Id"", t4.""Id"", t4.""CreatedAt"", t4.""Description"", t4.""DurationInHours"", t4.""LastModifiedAt"", t4.""Priority""
-FROM ""People"" AS t1
-LEFT JOIN (
- SELECT t2.""Id"", t2.""CreatedAt"", t2.""Description"", t2.""DurationInHours"", t2.""LastModifiedAt"", t2.""OwnerId"", t2.""Priority""
- FROM ""TodoItems"" AS t2
- LEFT JOIN ""People"" AS t3 ON t2.""AssigneeId"" = t3.""Id""
- WHERE t3.""Id"" IS NULL
-) AS t4 ON t1.""Id"" = t4.""OwnerId""
-WHERE t1.""Id"" = @p1
-ORDER BY t4.""Priority"", t4.""LastModifiedAt"" DESC"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id", t4."Id", t4."CreatedAt", t4."Description", t4."DurationInHours", t4."LastModifiedAt", t4."Priority"
+ FROM "People" AS t1
+ LEFT JOIN (
+ SELECT t2."Id", t2."CreatedAt", t2."Description", t2."DurationInHours", t2."LastModifiedAt", t2."OwnerId", t2."Priority"
+ FROM "TodoItems" AS t2
+ LEFT JOIN "People" AS t3 ON t2."AssigneeId" = t3."Id"
+ WHERE t3."Id" IS NULL
+ ) AS t4 ON t1."Id" = t4."OwnerId"
+ WHERE t1."Id" = @p1
+ ORDER BY t4."Priority", t4."LastModifiedAt" DESC
+ """));
command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().Contain("@p1", person.Id);
@@ -244,10 +255,12 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[0].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"SELECT COUNT(*)
-FROM ""TodoItems"" AS t1
-INNER JOIN ""People"" AS t2 ON t1.""OwnerId"" = t2.""Id""
-WHERE (t2.""Id"" = @p1) AND (t1.""DurationInHours"" IS NULL)"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT COUNT(*)
+ FROM "TodoItems" AS t1
+ INNER JOIN "People" AS t2 ON t1."OwnerId" = t2."Id"
+ WHERE (t2."Id" = @p1) AND (t1."DurationInHours" IS NULL)
+ """));
command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().Contain("@p1", person.Id);
@@ -255,16 +268,17 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[1].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(
- @"SELECT t1.""Id"", t3.""Id"", t3.""CreatedAt"", t3.""Description"", t3.""DurationInHours"", t3.""LastModifiedAt"", t3.""Priority""
-FROM ""People"" AS t1
-LEFT JOIN (
- SELECT t2.""Id"", t2.""CreatedAt"", t2.""Description"", t2.""DurationInHours"", t2.""LastModifiedAt"", t2.""OwnerId"", t2.""Priority""
- FROM ""TodoItems"" AS t2
- WHERE t2.""DurationInHours"" IS NULL
-) AS t3 ON t1.""Id"" = t3.""OwnerId""
-WHERE t1.""Id"" = @p1
-ORDER BY t3.""Priority"", t3.""LastModifiedAt"" DESC"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id", t3."Id", t3."CreatedAt", t3."Description", t3."DurationInHours", t3."LastModifiedAt", t3."Priority"
+ FROM "People" AS t1
+ LEFT JOIN (
+ SELECT t2."Id", t2."CreatedAt", t2."Description", t2."DurationInHours", t2."LastModifiedAt", t2."OwnerId", t2."Priority"
+ FROM "TodoItems" AS t2
+ WHERE t2."DurationInHours" IS NULL
+ ) AS t3 ON t1."Id" = t3."OwnerId"
+ WHERE t1."Id" = @p1
+ ORDER BY t3."Priority", t3."LastModifiedAt" DESC
+ """));
command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().Contain("@p1", person.Id);
@@ -309,9 +323,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[0].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"SELECT COUNT(*)
-FROM ""TodoItems"" AS t1
-WHERE t1.""Priority"" = @p1"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT COUNT(*)
+ FROM "TodoItems" AS t1
+ WHERE t1."Priority" = @p1
+ """));
command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().Contain("@p1", todoItems[1].Priority);
@@ -319,11 +335,12 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[1].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(
- @"SELECT t1.""Id"", t1.""CreatedAt"", t1.""Description"", t1.""DurationInHours"", t1.""LastModifiedAt"", t1.""Priority""
-FROM ""TodoItems"" AS t1
-WHERE t1.""Priority"" = @p1
-ORDER BY t1.""Priority"", t1.""LastModifiedAt"" DESC"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id", t1."CreatedAt", t1."Description", t1."DurationInHours", t1."LastModifiedAt", t1."Priority"
+ FROM "TodoItems" AS t1
+ WHERE t1."Priority" = @p1
+ ORDER BY t1."Priority", t1."LastModifiedAt" DESC
+ """));
command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().Contain("@p1", todoItems[1].Priority);
@@ -368,10 +385,12 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[0].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"SELECT COUNT(*)
-FROM ""TodoItems"" AS t1
-LEFT JOIN ""People"" AS t2 ON t1.""AssigneeId"" = t2.""Id""
-WHERE (t2.""Id"" = @p1) AND (t1.""Description"" = @p2)"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT COUNT(*)
+ FROM "TodoItems" AS t1
+ LEFT JOIN "People" AS t2 ON t1."AssigneeId" = t2."Id"
+ WHERE (t2."Id" = @p1) AND (t1."Description" = @p2)
+ """));
command.Parameters.ShouldHaveCount(2);
command.Parameters.Should().Contain("@p1", person.Id);
@@ -380,16 +399,17 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[1].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(
- @"SELECT t1.""Id"", t3.""Id"", t3.""CreatedAt"", t3.""Description"", t3.""DurationInHours"", t3.""LastModifiedAt"", t3.""Priority""
-FROM ""People"" AS t1
-LEFT JOIN (
- SELECT t2.""Id"", t2.""AssigneeId"", t2.""CreatedAt"", t2.""Description"", t2.""DurationInHours"", t2.""LastModifiedAt"", t2.""Priority""
- FROM ""TodoItems"" AS t2
- WHERE t2.""Description"" = @p2
-) AS t3 ON t1.""Id"" = t3.""AssigneeId""
-WHERE t1.""Id"" = @p1
-ORDER BY t3.""Priority"", t3.""LastModifiedAt"" DESC"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id", t3."Id", t3."CreatedAt", t3."Description", t3."DurationInHours", t3."LastModifiedAt", t3."Priority"
+ FROM "People" AS t1
+ LEFT JOIN (
+ SELECT t2."Id", t2."AssigneeId", t2."CreatedAt", t2."Description", t2."DurationInHours", t2."LastModifiedAt", t2."Priority"
+ FROM "TodoItems" AS t2
+ WHERE t2."Description" = @p2
+ ) AS t3 ON t1."Id" = t3."AssigneeId"
+ WHERE t1."Id" = @p1
+ ORDER BY t3."Priority", t3."LastModifiedAt" DESC
+ """));
command.Parameters.ShouldHaveCount(2);
command.Parameters.Should().Contain("@p1", person.Id);
@@ -435,22 +455,25 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[0].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"SELECT COUNT(*)
-FROM ""TodoItems"" AS t1
-LEFT JOIN ""People"" AS t2 ON t1.""AssigneeId"" = t2.""Id""
-WHERE t2.""LastName"" = t2.""FirstName"""));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT COUNT(*)
+ FROM "TodoItems" AS t1
+ LEFT JOIN "People" AS t2 ON t1."AssigneeId" = t2."Id"
+ WHERE t2."LastName" = t2."FirstName"
+ """));
command.Parameters.Should().BeEmpty();
});
store.SqlCommands[1].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(
- @"SELECT t1.""Id"", t1.""CreatedAt"", t1.""Description"", t1.""DurationInHours"", t1.""LastModifiedAt"", t1.""Priority""
-FROM ""TodoItems"" AS t1
-LEFT JOIN ""People"" AS t2 ON t1.""AssigneeId"" = t2.""Id""
-WHERE t2.""LastName"" = t2.""FirstName""
-ORDER BY t1.""Priority"", t1.""LastModifiedAt"" DESC"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id", t1."CreatedAt", t1."Description", t1."DurationInHours", t1."LastModifiedAt", t1."Priority"
+ FROM "TodoItems" AS t1
+ LEFT JOIN "People" AS t2 ON t1."AssigneeId" = t2."Id"
+ WHERE t2."LastName" = t2."FirstName"
+ ORDER BY t1."Priority", t1."LastModifiedAt" DESC
+ """));
command.Parameters.Should().BeEmpty();
});
@@ -493,10 +516,12 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[0].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"SELECT COUNT(*)
-FROM ""TodoItems"" AS t1
-INNER JOIN ""People"" AS t2 ON t1.""OwnerId"" = t2.""Id""
-WHERE (t2.""Id"" = @p1) AND (t1.""Priority"" = @p2)"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT COUNT(*)
+ FROM "TodoItems" AS t1
+ INNER JOIN "People" AS t2 ON t1."OwnerId" = t2."Id"
+ WHERE (t2."Id" = @p1) AND (t1."Priority" = @p2)
+ """));
command.Parameters.ShouldHaveCount(2);
command.Parameters.Should().Contain("@p1", person.Id);
@@ -505,16 +530,17 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[1].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(
- @"SELECT t1.""Id"", t3.""Id"", t3.""CreatedAt"", t3.""Description"", t3.""DurationInHours"", t3.""LastModifiedAt"", t3.""Priority""
-FROM ""People"" AS t1
-LEFT JOIN (
- SELECT t2.""Id"", t2.""CreatedAt"", t2.""Description"", t2.""DurationInHours"", t2.""LastModifiedAt"", t2.""OwnerId"", t2.""Priority""
- FROM ""TodoItems"" AS t2
- WHERE t2.""Priority"" = @p2
-) AS t3 ON t1.""Id"" = t3.""OwnerId""
-WHERE t1.""Id"" = @p1
-ORDER BY t3.""Priority"", t3.""LastModifiedAt"" DESC"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id", t3."Id", t3."CreatedAt", t3."Description", t3."DurationInHours", t3."LastModifiedAt", t3."Priority"
+ FROM "People" AS t1
+ LEFT JOIN (
+ SELECT t2."Id", t2."CreatedAt", t2."Description", t2."DurationInHours", t2."LastModifiedAt", t2."OwnerId", t2."Priority"
+ FROM "TodoItems" AS t2
+ WHERE t2."Priority" = @p2
+ ) AS t3 ON t1."Id" = t3."OwnerId"
+ WHERE t1."Id" = @p1
+ ORDER BY t3."Priority", t3."LastModifiedAt" DESC
+ """));
command.Parameters.ShouldHaveCount(2);
command.Parameters.Should().Contain("@p1", person.Id);
@@ -558,9 +584,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[0].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"SELECT COUNT(*)
-FROM ""TodoItems"" AS t1
-WHERE t1.""Description"" = @p1"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT COUNT(*)
+ FROM "TodoItems" AS t1
+ WHERE t1."Description" = @p1
+ """));
command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().Contain("@p1", "X");
@@ -568,11 +596,12 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[1].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(
- @"SELECT t1.""Id"", t1.""CreatedAt"", t1.""Description"", t1.""DurationInHours"", t1.""LastModifiedAt"", t1.""Priority""
-FROM ""TodoItems"" AS t1
-WHERE t1.""Description"" = @p1
-ORDER BY t1.""Priority"", t1.""LastModifiedAt"" DESC"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id", t1."CreatedAt", t1."Description", t1."DurationInHours", t1."LastModifiedAt", t1."Priority"
+ FROM "TodoItems" AS t1
+ WHERE t1."Description" = @p1
+ ORDER BY t1."Priority", t1."LastModifiedAt" DESC
+ """));
command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().Contain("@p1", "X");
@@ -617,9 +646,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[0].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"SELECT COUNT(*)
-FROM ""People"" AS t1
-WHERE (NOT (t1.""FirstName"" = @p1)) OR (t1.""FirstName"" IS NULL)"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT COUNT(*)
+ FROM "People" AS t1
+ WHERE (NOT (t1."FirstName" = @p1)) OR (t1."FirstName" IS NULL)
+ """));
command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().Contain("@p1", "X");
@@ -627,10 +658,12 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[1].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"SELECT t1.""Id"", t1.""FirstName"", t1.""LastName""
-FROM ""People"" AS t1
-WHERE (NOT (t1.""FirstName"" = @p1)) OR (t1.""FirstName"" IS NULL)
-ORDER BY t1.""Id"""));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id", t1."FirstName", t1."LastName"
+ FROM "People" AS t1
+ WHERE (NOT (t1."FirstName" = @p1)) OR (t1."FirstName" IS NULL)
+ ORDER BY t1."Id"
+ """));
command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().Contain("@p1", "X");
@@ -676,10 +709,12 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[0].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"SELECT COUNT(*)
-FROM ""TodoItems"" AS t1
-LEFT JOIN ""People"" AS t2 ON t1.""AssigneeId"" = t2.""Id""
-WHERE (NOT ((t2.""FirstName"" = @p1) AND (t2.""LastName"" = @p2))) OR (t2.""FirstName"" IS NULL) OR (t2.""LastName"" IS NULL)"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT COUNT(*)
+ FROM "TodoItems" AS t1
+ LEFT JOIN "People" AS t2 ON t1."AssigneeId" = t2."Id"
+ WHERE (NOT ((t2."FirstName" = @p1) AND (t2."LastName" = @p2))) OR (t2."FirstName" IS NULL) OR (t2."LastName" IS NULL)
+ """));
command.Parameters.ShouldHaveCount(2);
command.Parameters.Should().Contain("@p1", "X");
@@ -688,12 +723,13 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[1].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(
- @"SELECT t1.""Id"", t1.""CreatedAt"", t1.""Description"", t1.""DurationInHours"", t1.""LastModifiedAt"", t1.""Priority""
-FROM ""TodoItems"" AS t1
-LEFT JOIN ""People"" AS t2 ON t1.""AssigneeId"" = t2.""Id""
-WHERE (NOT ((t2.""FirstName"" = @p1) AND (t2.""LastName"" = @p2))) OR (t2.""FirstName"" IS NULL) OR (t2.""LastName"" IS NULL)
-ORDER BY t1.""Priority"", t1.""LastModifiedAt"" DESC"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id", t1."CreatedAt", t1."Description", t1."DurationInHours", t1."LastModifiedAt", t1."Priority"
+ FROM "TodoItems" AS t1
+ LEFT JOIN "People" AS t2 ON t1."AssigneeId" = t2."Id"
+ WHERE (NOT ((t2."FirstName" = @p1) AND (t2."LastName" = @p2))) OR (t2."FirstName" IS NULL) OR (t2."LastName" IS NULL)
+ ORDER BY t1."Priority", t1."LastModifiedAt" DESC
+ """));
command.Parameters.ShouldHaveCount(2);
command.Parameters.Should().Contain("@p1", "X");
@@ -742,10 +778,12 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[0].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"SELECT COUNT(*)
-FROM ""TodoItems"" AS t1
-INNER JOIN ""People"" AS t2 ON t1.""OwnerId"" = t2.""Id""
-WHERE (t1.""Description"" LIKE 'T%') AND (NOT (t1.""Description"" IN (@p1, @p2))) AND (t2.""FirstName"" = @p3) AND (t1.""Description"" LIKE '%o%')"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT COUNT(*)
+ FROM "TodoItems" AS t1
+ INNER JOIN "People" AS t2 ON t1."OwnerId" = t2."Id"
+ WHERE (t1."Description" LIKE 'T%') AND (NOT (t1."Description" IN (@p1, @p2))) AND (t2."FirstName" = @p3) AND (t1."Description" LIKE '%o%')
+ """));
command.Parameters.ShouldHaveCount(3);
command.Parameters.Should().Contain("@p1", "Four");
@@ -755,12 +793,13 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[1].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(
- @"SELECT t1.""Id"", t1.""CreatedAt"", t1.""Description"", t1.""DurationInHours"", t1.""LastModifiedAt"", t1.""Priority""
-FROM ""TodoItems"" AS t1
-INNER JOIN ""People"" AS t2 ON t1.""OwnerId"" = t2.""Id""
-WHERE (t1.""Description"" LIKE 'T%') AND (NOT (t1.""Description"" IN (@p1, @p2))) AND (t2.""FirstName"" = @p3) AND (t1.""Description"" LIKE '%o%')
-ORDER BY t1.""Priority"", t1.""LastModifiedAt"" DESC"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id", t1."CreatedAt", t1."Description", t1."DurationInHours", t1."LastModifiedAt", t1."Priority"
+ FROM "TodoItems" AS t1
+ INNER JOIN "People" AS t2 ON t1."OwnerId" = t2."Id"
+ WHERE (t1."Description" LIKE 'T%') AND (NOT (t1."Description" IN (@p1, @p2))) AND (t2."FirstName" = @p3) AND (t1."Description" LIKE '%o%')
+ ORDER BY t1."Priority", t1."LastModifiedAt" DESC
+ """));
command.Parameters.ShouldHaveCount(3);
command.Parameters.Should().Contain("@p1", "Four");
@@ -813,19 +852,23 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[0].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"SELECT COUNT(*)
-FROM ""Tags"" AS t1
-WHERE (t1.""Name"" LIKE '%A\%%' ESCAPE '\') OR (t1.""Name"" LIKE '%A\_%' ESCAPE '\') OR (t1.""Name"" LIKE '%A\\%' ESCAPE '\') OR (t1.""Name"" LIKE '%A''%') OR (t1.""Name"" LIKE '%\%\_\\''%' ESCAPE '\')"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT COUNT(*)
+ FROM "Tags" AS t1
+ WHERE (t1."Name" LIKE '%A\%%' ESCAPE '\') OR (t1."Name" LIKE '%A\_%' ESCAPE '\') OR (t1."Name" LIKE '%A\\%' ESCAPE '\') OR (t1."Name" LIKE '%A''%') OR (t1."Name" LIKE '%\%\_\\''%' ESCAPE '\')
+ """));
command.Parameters.Should().BeEmpty();
});
store.SqlCommands[1].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"SELECT t1.""Id"", t1.""Name""
-FROM ""Tags"" AS t1
-WHERE (t1.""Name"" LIKE '%A\%%' ESCAPE '\') OR (t1.""Name"" LIKE '%A\_%' ESCAPE '\') OR (t1.""Name"" LIKE '%A\\%' ESCAPE '\') OR (t1.""Name"" LIKE '%A''%') OR (t1.""Name"" LIKE '%\%\_\\''%' ESCAPE '\')
-ORDER BY t1.""Id"""));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id", t1."Name"
+ FROM "Tags" AS t1
+ WHERE (t1."Name" LIKE '%A\%%' ESCAPE '\') OR (t1."Name" LIKE '%A\_%' ESCAPE '\') OR (t1."Name" LIKE '%A\\%' ESCAPE '\') OR (t1."Name" LIKE '%A''%') OR (t1."Name" LIKE '%\%\_\\''%' ESCAPE '\')
+ ORDER BY t1."Id"
+ """));
command.Parameters.Should().BeEmpty();
});
@@ -871,9 +914,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[0].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"SELECT COUNT(*)
-FROM ""TodoItems"" AS t1
-WHERE (t1.""DurationInHours"" > @p1) OR (t1.""DurationInHours"" <= @p2)"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT COUNT(*)
+ FROM "TodoItems" AS t1
+ WHERE (t1."DurationInHours" > @p1) OR (t1."DurationInHours" <= @p2)
+ """));
command.Parameters.ShouldHaveCount(2);
command.Parameters.Should().Contain("@p1", 250);
@@ -882,11 +927,12 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[1].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(
- @"SELECT t1.""Id"", t1.""CreatedAt"", t1.""Description"", t1.""DurationInHours"", t1.""LastModifiedAt"", t1.""Priority""
-FROM ""TodoItems"" AS t1
-WHERE (t1.""DurationInHours"" > @p1) OR (t1.""DurationInHours"" <= @p2)
-ORDER BY t1.""Priority"", t1.""LastModifiedAt"" DESC"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id", t1."CreatedAt", t1."Description", t1."DurationInHours", t1."LastModifiedAt", t1."Priority"
+ FROM "TodoItems" AS t1
+ WHERE (t1."DurationInHours" > @p1) OR (t1."DurationInHours" <= @p2)
+ ORDER BY t1."Priority", t1."LastModifiedAt" DESC
+ """));
command.Parameters.ShouldHaveCount(2);
command.Parameters.Should().Contain("@p1", 250);
@@ -932,15 +978,17 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[0].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"SELECT COUNT(*)
-FROM ""TodoItems"" AS t1
-INNER JOIN ""People"" AS t4 ON t1.""OwnerId"" = t4.""Id""
-WHERE ((
- SELECT COUNT(*)
- FROM ""People"" AS t2
- LEFT JOIN ""TodoItems"" AS t3 ON t2.""Id"" = t3.""AssigneeId""
- WHERE t1.""OwnerId"" = t2.""Id""
-) > @p1) AND (NOT (t4.""Id"" IS NULL))"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT COUNT(*)
+ FROM "TodoItems" AS t1
+ INNER JOIN "People" AS t4 ON t1."OwnerId" = t4."Id"
+ WHERE ((
+ SELECT COUNT(*)
+ FROM "People" AS t2
+ LEFT JOIN "TodoItems" AS t3 ON t2."Id" = t3."AssigneeId"
+ WHERE t1."OwnerId" = t2."Id"
+ ) > @p1) AND (NOT (t4."Id" IS NULL))
+ """));
command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().Contain("@p1", 1);
@@ -948,17 +996,18 @@ SELECT COUNT(*)
store.SqlCommands[1].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(
- @"SELECT t1.""Id"", t1.""CreatedAt"", t1.""Description"", t1.""DurationInHours"", t1.""LastModifiedAt"", t1.""Priority""
-FROM ""TodoItems"" AS t1
-INNER JOIN ""People"" AS t4 ON t1.""OwnerId"" = t4.""Id""
-WHERE ((
- SELECT COUNT(*)
- FROM ""People"" AS t2
- LEFT JOIN ""TodoItems"" AS t3 ON t2.""Id"" = t3.""AssigneeId""
- WHERE t1.""OwnerId"" = t2.""Id""
-) > @p1) AND (NOT (t4.""Id"" IS NULL))
-ORDER BY t1.""Priority"", t1.""LastModifiedAt"" DESC"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id", t1."CreatedAt", t1."Description", t1."DurationInHours", t1."LastModifiedAt", t1."Priority"
+ FROM "TodoItems" AS t1
+ INNER JOIN "People" AS t4 ON t1."OwnerId" = t4."Id"
+ WHERE ((
+ SELECT COUNT(*)
+ FROM "People" AS t2
+ LEFT JOIN "TodoItems" AS t3 ON t2."Id" = t3."AssigneeId"
+ WHERE t1."OwnerId" = t2."Id"
+ ) > @p1) AND (NOT (t4."Id" IS NULL))
+ ORDER BY t1."Priority", t1."LastModifiedAt" DESC
+ """));
command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().Contain("@p1", 1);
@@ -1013,19 +1062,21 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[0].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"SELECT COUNT(*)
-FROM ""TodoItems"" AS t1
-WHERE EXISTS (
- SELECT 1
- FROM ""People"" AS t2
- LEFT JOIN ""TodoItems"" AS t3 ON t2.""Id"" = t3.""AssigneeId""
- INNER JOIN ""People"" AS t5 ON t3.""OwnerId"" = t5.""Id""
- WHERE (t1.""OwnerId"" = t2.""Id"") AND (EXISTS (
- SELECT 1
- FROM ""Tags"" AS t4
- WHERE (t3.""Id"" = t4.""TodoItemId"") AND (t4.""Name"" = @p1)
- )) AND (t5.""LastName"" = @p2) AND (t3.""Description"" = @p3)
-)"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT COUNT(*)
+ FROM "TodoItems" AS t1
+ WHERE EXISTS (
+ SELECT 1
+ FROM "People" AS t2
+ LEFT JOIN "TodoItems" AS t3 ON t2."Id" = t3."AssigneeId"
+ INNER JOIN "People" AS t5 ON t3."OwnerId" = t5."Id"
+ WHERE (t1."OwnerId" = t2."Id") AND (EXISTS (
+ SELECT 1
+ FROM "Tags" AS t4
+ WHERE (t3."Id" = t4."TodoItemId") AND (t4."Name" = @p1)
+ )) AND (t5."LastName" = @p2) AND (t3."Description" = @p3)
+ )
+ """));
command.Parameters.ShouldHaveCount(3);
command.Parameters.Should().Contain("@p1", "Personal");
@@ -1035,21 +1086,22 @@ SELECT 1
store.SqlCommands[1].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(
- @"SELECT t1.""Id"", t1.""CreatedAt"", t1.""Description"", t1.""DurationInHours"", t1.""LastModifiedAt"", t1.""Priority""
-FROM ""TodoItems"" AS t1
-WHERE EXISTS (
- SELECT 1
- FROM ""People"" AS t2
- LEFT JOIN ""TodoItems"" AS t3 ON t2.""Id"" = t3.""AssigneeId""
- INNER JOIN ""People"" AS t5 ON t3.""OwnerId"" = t5.""Id""
- WHERE (t1.""OwnerId"" = t2.""Id"") AND (EXISTS (
- SELECT 1
- FROM ""Tags"" AS t4
- WHERE (t3.""Id"" = t4.""TodoItemId"") AND (t4.""Name"" = @p1)
- )) AND (t5.""LastName"" = @p2) AND (t3.""Description"" = @p3)
-)
-ORDER BY t1.""Priority"", t1.""LastModifiedAt"" DESC"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id", t1."CreatedAt", t1."Description", t1."DurationInHours", t1."LastModifiedAt", t1."Priority"
+ FROM "TodoItems" AS t1
+ WHERE EXISTS (
+ SELECT 1
+ FROM "People" AS t2
+ LEFT JOIN "TodoItems" AS t3 ON t2."Id" = t3."AssigneeId"
+ INNER JOIN "People" AS t5 ON t3."OwnerId" = t5."Id"
+ WHERE (t1."OwnerId" = t2."Id") AND (EXISTS (
+ SELECT 1
+ FROM "Tags" AS t4
+ WHERE (t3."Id" = t4."TodoItemId") AND (t4."Name" = @p1)
+ )) AND (t5."LastName" = @p2) AND (t3."Description" = @p3)
+ )
+ ORDER BY t1."Priority", t1."LastModifiedAt" DESC
+ """));
command.Parameters.ShouldHaveCount(3);
command.Parameters.Should().Contain("@p1", "Personal");
@@ -1100,29 +1152,33 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[0].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"SELECT COUNT(*)
-FROM ""People"" AS t1
-WHERE EXISTS (
- SELECT 1
- FROM ""TodoItems"" AS t2
- LEFT JOIN ""People"" AS t3 ON t2.""AssigneeId"" = t3.""Id""
- WHERE (t1.""Id"" = t2.""OwnerId"") AND (NOT (t3.""Id"" IS NULL)) AND (t3.""FirstName"" IS NULL)
-)"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT COUNT(*)
+ FROM "People" AS t1
+ WHERE EXISTS (
+ SELECT 1
+ FROM "TodoItems" AS t2
+ LEFT JOIN "People" AS t3 ON t2."AssigneeId" = t3."Id"
+ WHERE (t1."Id" = t2."OwnerId") AND (NOT (t3."Id" IS NULL)) AND (t3."FirstName" IS NULL)
+ )
+ """));
command.Parameters.Should().BeEmpty();
});
store.SqlCommands[1].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"SELECT t1.""Id"", t1.""FirstName"", t1.""LastName""
-FROM ""People"" AS t1
-WHERE EXISTS (
- SELECT 1
- FROM ""TodoItems"" AS t2
- LEFT JOIN ""People"" AS t3 ON t2.""AssigneeId"" = t3.""Id""
- WHERE (t1.""Id"" = t2.""OwnerId"") AND (NOT (t3.""Id"" IS NULL)) AND (t3.""FirstName"" IS NULL)
-)
-ORDER BY t1.""Id"""));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id", t1."FirstName", t1."LastName"
+ FROM "People" AS t1
+ WHERE EXISTS (
+ SELECT 1
+ FROM "TodoItems" AS t2
+ LEFT JOIN "People" AS t3 ON t2."AssigneeId" = t3."Id"
+ WHERE (t1."Id" = t2."OwnerId") AND (NOT (t3."Id" IS NULL)) AND (t3."FirstName" IS NULL)
+ )
+ ORDER BY t1."Id"
+ """));
command.Parameters.Should().BeEmpty();
});
@@ -1185,9 +1241,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[0].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"SELECT COUNT(*)
-FROM ""TodoItems"" AS t1
-WHERE (t1.""Description"" = @p1) AND ((t1.""Priority"" = @p2) OR (t1.""DurationInHours"" = @p3))"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT COUNT(*)
+ FROM "TodoItems" AS t1
+ WHERE (t1."Description" = @p1) AND ((t1."Priority" = @p2) OR (t1."DurationInHours" = @p3))
+ """));
command.Parameters.ShouldHaveCount(3);
command.Parameters.Should().Contain("@p1", "1");
@@ -1197,11 +1255,12 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[1].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(
- @"SELECT t1.""Id"", t1.""CreatedAt"", t1.""Description"", t1.""DurationInHours"", t1.""LastModifiedAt"", t1.""Priority""
-FROM ""TodoItems"" AS t1
-WHERE (t1.""Description"" = @p1) AND ((t1.""Priority"" = @p2) OR (t1.""DurationInHours"" = @p3))
-ORDER BY t1.""Priority"", t1.""LastModifiedAt"" DESC"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id", t1."CreatedAt", t1."Description", t1."DurationInHours", t1."LastModifiedAt", t1."Priority"
+ FROM "TodoItems" AS t1
+ WHERE (t1."Description" = @p1) AND ((t1."Priority" = @p2) OR (t1."DurationInHours" = @p3))
+ ORDER BY t1."Priority", t1."LastModifiedAt" DESC
+ """));
command.Parameters.ShouldHaveCount(3);
command.Parameters.Should().Contain("@p1", "1");
diff --git a/test/DapperTests/IntegrationTests/QueryStrings/IncludeTests.cs b/test/DapperTests/IntegrationTests/QueryStrings/IncludeTests.cs
index 153e028b01..09d307a256 100644
--- a/test/DapperTests/IntegrationTests/QueryStrings/IncludeTests.cs
+++ b/test/DapperTests/IntegrationTests/QueryStrings/IncludeTests.cs
@@ -148,22 +148,25 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[0].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"SELECT COUNT(*)
-FROM ""TodoItems"" AS t1"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT COUNT(*)
+ FROM "TodoItems" AS t1
+ """));
command.Parameters.Should().BeEmpty();
});
store.SqlCommands[1].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(
- @"SELECT t1.""Id"", t1.""CreatedAt"", t1.""Description"", t1.""DurationInHours"", t1.""LastModifiedAt"", t1.""Priority"", t2.""Id"", t2.""FirstName"", t2.""LastName"", t3.""Id"", t3.""FirstName"", t3.""LastName"", t4.""Id"", t4.""CreatedAt"", t4.""Description"", t4.""DurationInHours"", t4.""LastModifiedAt"", t4.""Priority"", t5.""Id"", t5.""Name""
-FROM ""TodoItems"" AS t1
-LEFT JOIN ""People"" AS t2 ON t1.""AssigneeId"" = t2.""Id""
-INNER JOIN ""People"" AS t3 ON t1.""OwnerId"" = t3.""Id""
-LEFT JOIN ""TodoItems"" AS t4 ON t3.""Id"" = t4.""AssigneeId""
-LEFT JOIN ""Tags"" AS t5 ON t1.""Id"" = t5.""TodoItemId""
-ORDER BY t1.""Priority"", t1.""LastModifiedAt"" DESC, t4.""Priority"", t4.""LastModifiedAt"" DESC, t5.""Id"""));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id", t1."CreatedAt", t1."Description", t1."DurationInHours", t1."LastModifiedAt", t1."Priority", t2."Id", t2."FirstName", t2."LastName", t3."Id", t3."FirstName", t3."LastName", t4."Id", t4."CreatedAt", t4."Description", t4."DurationInHours", t4."LastModifiedAt", t4."Priority", t5."Id", t5."Name"
+ FROM "TodoItems" AS t1
+ LEFT JOIN "People" AS t2 ON t1."AssigneeId" = t2."Id"
+ INNER JOIN "People" AS t3 ON t1."OwnerId" = t3."Id"
+ LEFT JOIN "TodoItems" AS t4 ON t3."Id" = t4."AssigneeId"
+ LEFT JOIN "Tags" AS t5 ON t1."Id" = t5."TodoItemId"
+ ORDER BY t1."Priority", t1."LastModifiedAt" DESC, t4."Priority", t4."LastModifiedAt" DESC, t5."Id"
+ """));
command.Parameters.Should().BeEmpty();
});
@@ -213,20 +216,23 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[0].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"SELECT COUNT(*)
-FROM ""TodoItems"" AS t1"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT COUNT(*)
+ FROM "TodoItems" AS t1
+ """));
command.Parameters.Should().BeEmpty();
});
store.SqlCommands[1].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(
- @"SELECT t1.""Id"", t1.""CreatedAt"", t1.""Description"", t1.""DurationInHours"", t1.""LastModifiedAt"", t1.""Priority"", t2.""Id"", t2.""Name"", t3.""Id""
-FROM ""TodoItems"" AS t1
-LEFT JOIN ""Tags"" AS t2 ON t1.""Id"" = t2.""TodoItemId""
-LEFT JOIN ""RgbColors"" AS t3 ON t2.""Id"" = t3.""TagId""
-ORDER BY t1.""Priority"", t1.""LastModifiedAt"" DESC, t2.""Id"""));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id", t1."CreatedAt", t1."Description", t1."DurationInHours", t1."LastModifiedAt", t1."Priority", t2."Id", t2."Name", t3."Id"
+ FROM "TodoItems" AS t1
+ LEFT JOIN "Tags" AS t2 ON t1."Id" = t2."TodoItemId"
+ LEFT JOIN "RgbColors" AS t3 ON t2."Id" = t3."TagId"
+ ORDER BY t1."Priority", t1."LastModifiedAt" DESC, t2."Id"
+ """));
command.Parameters.Should().BeEmpty();
});
diff --git a/test/DapperTests/IntegrationTests/QueryStrings/SortTests.cs b/test/DapperTests/IntegrationTests/QueryStrings/SortTests.cs
index bdde400b84..33643519ce 100644
--- a/test/DapperTests/IntegrationTests/QueryStrings/SortTests.cs
+++ b/test/DapperTests/IntegrationTests/QueryStrings/SortTests.cs
@@ -60,18 +60,21 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[0].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"SELECT COUNT(*)
-FROM ""TodoItems"" AS t1"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT COUNT(*)
+ FROM "TodoItems" AS t1
+ """));
command.Parameters.Should().BeEmpty();
});
store.SqlCommands[1].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(
- @"SELECT t1.""Id"", t1.""CreatedAt"", t1.""Description"", t1.""DurationInHours"", t1.""LastModifiedAt"", t1.""Priority""
-FROM ""TodoItems"" AS t1
-ORDER BY t1.""Description"" DESC, t1.""DurationInHours"", t1.""Id"""));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id", t1."CreatedAt", t1."Description", t1."DurationInHours", t1."LastModifiedAt", t1."Priority"
+ FROM "TodoItems" AS t1
+ ORDER BY t1."Description" DESC, t1."DurationInHours", t1."Id"
+ """));
command.Parameters.Should().BeEmpty();
});
@@ -125,10 +128,12 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[0].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"SELECT COUNT(*)
-FROM ""TodoItems"" AS t1
-INNER JOIN ""People"" AS t2 ON t1.""OwnerId"" = t2.""Id""
-WHERE t2.""Id"" = @p1"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT COUNT(*)
+ FROM "TodoItems" AS t1
+ INNER JOIN "People" AS t2 ON t1."OwnerId" = t2."Id"
+ WHERE t2."Id" = @p1
+ """));
command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().Contain("@p1", person.Id);
@@ -136,13 +141,14 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[1].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(
- @"SELECT t1.""Id"", t2.""Id"", t2.""CreatedAt"", t2.""Description"", t2.""DurationInHours"", t2.""LastModifiedAt"", t2.""Priority"", t3.""Id"", t3.""Name""
-FROM ""People"" AS t1
-LEFT JOIN ""TodoItems"" AS t2 ON t1.""Id"" = t2.""OwnerId""
-LEFT JOIN ""Tags"" AS t3 ON t2.""Id"" = t3.""TodoItemId""
-WHERE t1.""Id"" = @p1
-ORDER BY t2.""DurationInHours"" DESC, t3.""Name"""));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id", t2."Id", t2."CreatedAt", t2."Description", t2."DurationInHours", t2."LastModifiedAt", t2."Priority", t3."Id", t3."Name"
+ FROM "People" AS t1
+ LEFT JOIN "TodoItems" AS t2 ON t1."Id" = t2."OwnerId"
+ LEFT JOIN "Tags" AS t3 ON t2."Id" = t3."TodoItemId"
+ WHERE t1."Id" = @p1
+ ORDER BY t2."DurationInHours" DESC, t3."Name"
+ """));
command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().Contain("@p1", person.Id);
@@ -188,22 +194,25 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[0].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"SELECT COUNT(*)
-FROM ""TodoItems"" AS t1"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT COUNT(*)
+ FROM "TodoItems" AS t1
+ """));
command.Parameters.Should().BeEmpty();
});
store.SqlCommands[1].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(
- @"SELECT t1.""Id"", t1.""CreatedAt"", t1.""Description"", t1.""DurationInHours"", t1.""LastModifiedAt"", t1.""Priority""
-FROM ""TodoItems"" AS t1
-ORDER BY (
- SELECT COUNT(*)
- FROM ""Tags"" AS t2
- WHERE t1.""Id"" = t2.""TodoItemId""
-) DESC, t1.""Id"""));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id", t1."CreatedAt", t1."Description", t1."DurationInHours", t1."LastModifiedAt", t1."Priority"
+ FROM "TodoItems" AS t1
+ ORDER BY (
+ SELECT COUNT(*)
+ FROM "Tags" AS t2
+ WHERE t1."Id" = t2."TodoItemId"
+ ) DESC, t1."Id"
+ """));
command.Parameters.Should().BeEmpty();
});
@@ -248,10 +257,12 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[0].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"SELECT COUNT(*)
-FROM ""TodoItems"" AS t1
-INNER JOIN ""People"" AS t2 ON t1.""OwnerId"" = t2.""Id""
-WHERE t2.""Id"" = @p1"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT COUNT(*)
+ FROM "TodoItems" AS t1
+ INNER JOIN "People" AS t2 ON t1."OwnerId" = t2."Id"
+ WHERE t2."Id" = @p1
+ """));
command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().Contain("@p1", person.Id);
@@ -259,16 +270,17 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[1].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(
- @"SELECT t1.""Id"", t2.""Id"", t2.""CreatedAt"", t2.""Description"", t2.""DurationInHours"", t2.""LastModifiedAt"", t2.""Priority""
-FROM ""People"" AS t1
-LEFT JOIN ""TodoItems"" AS t2 ON t1.""Id"" = t2.""OwnerId""
-WHERE t1.""Id"" = @p1
-ORDER BY (
- SELECT COUNT(*)
- FROM ""Tags"" AS t3
- WHERE t2.""Id"" = t3.""TodoItemId""
-) DESC, t2.""Id"""));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id", t2."Id", t2."CreatedAt", t2."Description", t2."DurationInHours", t2."LastModifiedAt", t2."Priority"
+ FROM "People" AS t1
+ LEFT JOIN "TodoItems" AS t2 ON t1."Id" = t2."OwnerId"
+ WHERE t1."Id" = @p1
+ ORDER BY (
+ SELECT COUNT(*)
+ FROM "Tags" AS t3
+ WHERE t2."Id" = t3."TodoItemId"
+ ) DESC, t2."Id"
+ """));
command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().Contain("@p1", person.Id);
@@ -314,10 +326,12 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[0].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"SELECT COUNT(*)
-FROM ""TodoItems"" AS t1
-INNER JOIN ""People"" AS t2 ON t1.""OwnerId"" = t2.""Id""
-WHERE t2.""Id"" = @p1"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT COUNT(*)
+ FROM "TodoItems" AS t1
+ INNER JOIN "People" AS t2 ON t1."OwnerId" = t2."Id"
+ WHERE t2."Id" = @p1
+ """));
command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().Contain("@p1", person.Id);
@@ -325,17 +339,18 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[1].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(
- @"SELECT t1.""Id"", t2.""Id"", t2.""CreatedAt"", t2.""Description"", t2.""DurationInHours"", t2.""LastModifiedAt"", t2.""Priority"", t4.""Id"", t4.""Name""
-FROM ""People"" AS t1
-LEFT JOIN ""TodoItems"" AS t2 ON t1.""Id"" = t2.""OwnerId""
-LEFT JOIN ""Tags"" AS t4 ON t2.""Id"" = t4.""TodoItemId""
-WHERE t1.""Id"" = @p1
-ORDER BY (
- SELECT COUNT(*)
- FROM ""Tags"" AS t3
- WHERE t2.""Id"" = t3.""TodoItemId""
-) DESC, t2.""Id"", t4.""Id"""));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id", t2."Id", t2."CreatedAt", t2."Description", t2."DurationInHours", t2."LastModifiedAt", t2."Priority", t4."Id", t4."Name"
+ FROM "People" AS t1
+ LEFT JOIN "TodoItems" AS t2 ON t1."Id" = t2."OwnerId"
+ LEFT JOIN "Tags" AS t4 ON t2."Id" = t4."TodoItemId"
+ WHERE t1."Id" = @p1
+ ORDER BY (
+ SELECT COUNT(*)
+ FROM "Tags" AS t3
+ WHERE t2."Id" = t3."TodoItemId"
+ ) DESC, t2."Id", t4."Id"
+ """));
command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().Contain("@p1", person.Id);
@@ -386,23 +401,26 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[0].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"SELECT COUNT(*)
-FROM ""People"" AS t1"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT COUNT(*)
+ FROM "People" AS t1
+ """));
command.Parameters.Should().BeEmpty();
});
store.SqlCommands[1].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(
- @"SELECT t1.""Id"", t1.""FirstName"", t1.""LastName"", t2.""Id"", t2.""CreatedAt"", t2.""Description"", t2.""DurationInHours"", t2.""LastModifiedAt"", t2.""Priority""
-FROM ""People"" AS t1
-LEFT JOIN ""TodoItems"" AS t2 ON t1.""Id"" = t2.""OwnerId""
-ORDER BY t1.""Id"", (
- SELECT COUNT(*)
- FROM ""Tags"" AS t3
- WHERE t2.""Id"" = t3.""TodoItemId""
-) DESC, t2.""Id"""));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id", t1."FirstName", t1."LastName", t2."Id", t2."CreatedAt", t2."Description", t2."DurationInHours", t2."LastModifiedAt", t2."Priority"
+ FROM "People" AS t1
+ LEFT JOIN "TodoItems" AS t2 ON t1."Id" = t2."OwnerId"
+ ORDER BY t1."Id", (
+ SELECT COUNT(*)
+ FROM "Tags" AS t3
+ WHERE t2."Id" = t3."TodoItemId"
+ ) DESC, t2."Id"
+ """));
command.Parameters.Should().BeEmpty();
});
diff --git a/test/DapperTests/IntegrationTests/QueryStrings/SparseFieldSets.cs b/test/DapperTests/IntegrationTests/QueryStrings/SparseFieldSets.cs
index 719b3b2d36..e66616810e 100644
--- a/test/DapperTests/IntegrationTests/QueryStrings/SparseFieldSets.cs
+++ b/test/DapperTests/IntegrationTests/QueryStrings/SparseFieldSets.cs
@@ -88,20 +88,23 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[0].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"SELECT COUNT(*)
-FROM ""TodoItems"" AS t1"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT COUNT(*)
+ FROM "TodoItems" AS t1
+ """));
command.Parameters.Should().BeEmpty();
});
store.SqlCommands[1].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(
- @"SELECT t1.""Id"", t1.""Description"", t1.""DurationInHours"", t2.""Id"", t2.""LastName"", t3.""Id"", t3.""LastName""
-FROM ""TodoItems"" AS t1
-LEFT JOIN ""People"" AS t2 ON t1.""AssigneeId"" = t2.""Id""
-INNER JOIN ""People"" AS t3 ON t1.""OwnerId"" = t3.""Id""
-ORDER BY t1.""Priority"", t1.""LastModifiedAt"" DESC"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id", t1."Description", t1."DurationInHours", t2."Id", t2."LastName", t3."Id", t3."LastName"
+ FROM "TodoItems" AS t1
+ LEFT JOIN "People" AS t2 ON t1."AssigneeId" = t2."Id"
+ INNER JOIN "People" AS t3 ON t1."OwnerId" = t3."Id"
+ ORDER BY t1."Priority", t1."LastModifiedAt" DESC
+ """));
command.Parameters.Should().BeEmpty();
});
@@ -142,9 +145,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[0].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"SELECT t1.""Id"", t1.""Description""
-FROM ""TodoItems"" AS t1
-WHERE t1.""Id"" = @p1"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id", t1."Description"
+ FROM "TodoItems" AS t1
+ WHERE t1."Id" = @p1
+ """));
command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().Contain("@p1", todoItem.Id);
@@ -192,10 +197,12 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[0].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"SELECT COUNT(*)
-FROM ""Tags"" AS t1
-LEFT JOIN ""TodoItems"" AS t2 ON t1.""TodoItemId"" = t2.""Id""
-WHERE t2.""Id"" = @p1"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT COUNT(*)
+ FROM "Tags" AS t1
+ LEFT JOIN "TodoItems" AS t2 ON t1."TodoItemId" = t2."Id"
+ WHERE t2."Id" = @p1
+ """));
command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().Contain("@p1", todoItem.Id);
@@ -203,11 +210,13 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[1].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"SELECT t1.""Id"", t2.""Id""
-FROM ""TodoItems"" AS t1
-LEFT JOIN ""Tags"" AS t2 ON t1.""Id"" = t2.""TodoItemId""
-WHERE t1.""Id"" = @p1
-ORDER BY t2.""Id"""));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id", t2."Id"
+ FROM "TodoItems" AS t1
+ LEFT JOIN "Tags" AS t2 ON t1."Id" = t2."TodoItemId"
+ WHERE t1."Id" = @p1
+ ORDER BY t2."Id"
+ """));
command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().Contain("@p1", todoItem.Id);
@@ -247,9 +256,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[0].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"SELECT t1.""Id""
-FROM ""People"" AS t1
-WHERE t1.""Id"" = @p1"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id"
+ FROM "People" AS t1
+ WHERE t1."Id" = @p1
+ """));
command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().Contain("@p1", person.Id);
@@ -289,9 +300,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[0].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"SELECT t1.""Id""
-FROM ""People"" AS t1
-WHERE t1.""Id"" = @p1"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id"
+ FROM "People" AS t1
+ WHERE t1."Id" = @p1
+ """));
command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().Contain("@p1", person.Id);
@@ -332,9 +345,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[0].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"SELECT t1.""Id"", t1.""FirstName"", t1.""LastName""
-FROM ""People"" AS t1
-WHERE t1.""Id"" = @p1"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id", t1."FirstName", t1."LastName"
+ FROM "People" AS t1
+ WHERE t1."Id" = @p1
+ """));
command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().Contain("@p1", person.Id);
@@ -380,11 +395,13 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[0].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"SELECT t1.""Id"", t1.""Description"", t2.""Id"", t2.""Name""
-FROM ""TodoItems"" AS t1
-LEFT JOIN ""Tags"" AS t2 ON t1.""Id"" = t2.""TodoItemId""
-WHERE t1.""Id"" = @p1
-ORDER BY t2.""Id"""));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id", t1."Description", t2."Id", t2."Name"
+ FROM "TodoItems" AS t1
+ LEFT JOIN "Tags" AS t2 ON t1."Id" = t2."TodoItemId"
+ WHERE t1."Id" = @p1
+ ORDER BY t2."Id"
+ """));
command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().Contain("@p1", todoItem.Id);
diff --git a/test/DapperTests/IntegrationTests/ReadWrite/Relationships/AddToToManyRelationshipTests.cs b/test/DapperTests/IntegrationTests/ReadWrite/Relationships/AddToToManyRelationshipTests.cs
index 80206b0750..e6c49c1f62 100644
--- a/test/DapperTests/IntegrationTests/ReadWrite/Relationships/AddToToManyRelationshipTests.cs
+++ b/test/DapperTests/IntegrationTests/ReadWrite/Relationships/AddToToManyRelationshipTests.cs
@@ -80,9 +80,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[0].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"UPDATE ""TodoItems""
-SET ""OwnerId"" = @p1
-WHERE ""Id"" IN (@p2, @p3)"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ UPDATE "TodoItems"
+ SET "OwnerId" = @p1
+ WHERE "Id" IN (@p2, @p3)
+ """));
command.Parameters.ShouldHaveCount(3);
command.Parameters.Should().Contain("@p1", existingPerson.Id);
diff --git a/test/DapperTests/IntegrationTests/ReadWrite/Relationships/FetchRelationshipTests.cs b/test/DapperTests/IntegrationTests/ReadWrite/Relationships/FetchRelationshipTests.cs
index 22ebd01a4e..227bbdb755 100644
--- a/test/DapperTests/IntegrationTests/ReadWrite/Relationships/FetchRelationshipTests.cs
+++ b/test/DapperTests/IntegrationTests/ReadWrite/Relationships/FetchRelationshipTests.cs
@@ -56,10 +56,12 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[0].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"SELECT t1.""Id"", t2.""Id""
-FROM ""TodoItems"" AS t1
-INNER JOIN ""People"" AS t2 ON t1.""OwnerId"" = t2.""Id""
-WHERE t1.""Id"" = @p1"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id", t2."Id"
+ FROM "TodoItems" AS t1
+ INNER JOIN "People" AS t2 ON t1."OwnerId" = t2."Id"
+ WHERE t1."Id" = @p1
+ """));
command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().Contain("@p1", todoItem.Id);
@@ -99,10 +101,12 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[0].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"SELECT t1.""Id"", t2.""Id""
-FROM ""TodoItems"" AS t1
-LEFT JOIN ""People"" AS t2 ON t1.""AssigneeId"" = t2.""Id""
-WHERE t1.""Id"" = @p1"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id", t2."Id"
+ FROM "TodoItems" AS t1
+ LEFT JOIN "People" AS t2 ON t1."AssigneeId" = t2."Id"
+ WHERE t1."Id" = @p1
+ """));
command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().Contain("@p1", todoItem.Id);
@@ -146,10 +150,12 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[0].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"SELECT COUNT(*)
-FROM ""Tags"" AS t1
-LEFT JOIN ""TodoItems"" AS t2 ON t1.""TodoItemId"" = t2.""Id""
-WHERE t2.""Id"" = @p1"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT COUNT(*)
+ FROM "Tags" AS t1
+ LEFT JOIN "TodoItems" AS t2 ON t1."TodoItemId" = t2."Id"
+ WHERE t2."Id" = @p1
+ """));
command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().Contain("@p1", todoItem.Id);
@@ -157,11 +163,13 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[1].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"SELECT t1.""Id"", t2.""Id""
-FROM ""TodoItems"" AS t1
-LEFT JOIN ""Tags"" AS t2 ON t1.""Id"" = t2.""TodoItemId""
-WHERE t1.""Id"" = @p1
-ORDER BY t2.""Id"""));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id", t2."Id"
+ FROM "TodoItems" AS t1
+ LEFT JOIN "Tags" AS t2 ON t1."Id" = t2."TodoItemId"
+ WHERE t1."Id" = @p1
+ ORDER BY t2."Id"
+ """));
command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().Contain("@p1", todoItem.Id);
diff --git a/test/DapperTests/IntegrationTests/ReadWrite/Relationships/RemoveFromToManyRelationshipTests.cs b/test/DapperTests/IntegrationTests/ReadWrite/Relationships/RemoveFromToManyRelationshipTests.cs
index c118d8ff59..f31a89c73e 100644
--- a/test/DapperTests/IntegrationTests/ReadWrite/Relationships/RemoveFromToManyRelationshipTests.cs
+++ b/test/DapperTests/IntegrationTests/ReadWrite/Relationships/RemoveFromToManyRelationshipTests.cs
@@ -82,14 +82,16 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[0].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"SELECT t1.""Id"", t3.""Id""
-FROM ""People"" AS t1
-LEFT JOIN (
- SELECT t2.""Id"", t2.""AssigneeId""
- FROM ""TodoItems"" AS t2
- WHERE t2.""Id"" IN (@p2, @p3)
-) AS t3 ON t1.""Id"" = t3.""AssigneeId""
-WHERE t1.""Id"" = @p1"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id", t3."Id"
+ FROM "People" AS t1
+ LEFT JOIN (
+ SELECT t2."Id", t2."AssigneeId"
+ FROM "TodoItems" AS t2
+ WHERE t2."Id" IN (@p2, @p3)
+ ) AS t3 ON t1."Id" = t3."AssigneeId"
+ WHERE t1."Id" = @p1
+ """));
command.Parameters.ShouldHaveCount(3);
command.Parameters.Should().Contain("@p1", existingPerson.Id);
@@ -99,9 +101,11 @@ LEFT JOIN (
store.SqlCommands[1].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"SELECT t1.""Id""
-FROM ""TodoItems"" AS t1
-WHERE t1.""Id"" IN (@p1, @p2)"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id"
+ FROM "TodoItems" AS t1
+ WHERE t1."Id" IN (@p1, @p2)
+ """));
command.Parameters.ShouldHaveCount(2);
command.Parameters.Should().Contain("@p1", existingPerson.AssignedTodoItems.ElementAt(0).Id);
@@ -110,9 +114,11 @@ LEFT JOIN (
store.SqlCommands[2].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"UPDATE ""TodoItems""
-SET ""AssigneeId"" = @p1
-WHERE ""Id"" IN (@p2, @p3)"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ UPDATE "TodoItems"
+ SET "AssigneeId" = @p1
+ WHERE "Id" IN (@p2, @p3)
+ """));
command.Parameters.ShouldHaveCount(3);
command.Parameters.Should().Contain("@p1", null);
@@ -181,14 +187,16 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[0].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"SELECT t1.""Id"", t3.""Id""
-FROM ""People"" AS t1
-LEFT JOIN (
- SELECT t2.""Id"", t2.""OwnerId""
- FROM ""TodoItems"" AS t2
- WHERE t2.""Id"" IN (@p2, @p3)
-) AS t3 ON t1.""Id"" = t3.""OwnerId""
-WHERE t1.""Id"" = @p1"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id", t3."Id"
+ FROM "People" AS t1
+ LEFT JOIN (
+ SELECT t2."Id", t2."OwnerId"
+ FROM "TodoItems" AS t2
+ WHERE t2."Id" IN (@p2, @p3)
+ ) AS t3 ON t1."Id" = t3."OwnerId"
+ WHERE t1."Id" = @p1
+ """));
command.Parameters.ShouldHaveCount(3);
command.Parameters.Should().Contain("@p1", existingPerson.Id);
@@ -198,9 +206,11 @@ LEFT JOIN (
store.SqlCommands[1].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"SELECT t1.""Id""
-FROM ""TodoItems"" AS t1
-WHERE t1.""Id"" IN (@p1, @p2)"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id"
+ FROM "TodoItems" AS t1
+ WHERE t1."Id" IN (@p1, @p2)
+ """));
command.Parameters.ShouldHaveCount(2);
command.Parameters.Should().Contain("@p1", existingPerson.OwnedTodoItems.ElementAt(0).Id);
@@ -209,8 +219,10 @@ LEFT JOIN (
store.SqlCommands[2].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"DELETE FROM ""TodoItems""
-WHERE ""Id"" IN (@p1, @p2)"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ DELETE FROM "TodoItems"
+ WHERE "Id" IN (@p1, @p2)
+ """));
command.Parameters.ShouldHaveCount(2);
command.Parameters.Should().Contain("@p1", existingPerson.OwnedTodoItems.ElementAt(0).Id);
diff --git a/test/DapperTests/IntegrationTests/ReadWrite/Relationships/ReplaceToManyRelationshipTests.cs b/test/DapperTests/IntegrationTests/ReadWrite/Relationships/ReplaceToManyRelationshipTests.cs
index e1bbcf1190..05b0710132 100644
--- a/test/DapperTests/IntegrationTests/ReadWrite/Relationships/ReplaceToManyRelationshipTests.cs
+++ b/test/DapperTests/IntegrationTests/ReadWrite/Relationships/ReplaceToManyRelationshipTests.cs
@@ -63,11 +63,12 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[0].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(
- @"SELECT t1.""Id"", t1.""FirstName"", t1.""LastName"", t2.""Id"", t2.""CreatedAt"", t2.""Description"", t2.""DurationInHours"", t2.""LastModifiedAt"", t2.""Priority""
-FROM ""People"" AS t1
-LEFT JOIN ""TodoItems"" AS t2 ON t1.""Id"" = t2.""AssigneeId""
-WHERE t1.""Id"" = @p1"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id", t1."FirstName", t1."LastName", t2."Id", t2."CreatedAt", t2."Description", t2."DurationInHours", t2."LastModifiedAt", t2."Priority"
+ FROM "People" AS t1
+ LEFT JOIN "TodoItems" AS t2 ON t1."Id" = t2."AssigneeId"
+ WHERE t1."Id" = @p1
+ """));
command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().Contain("@p1", existingPerson.Id);
@@ -75,9 +76,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[1].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"UPDATE ""TodoItems""
-SET ""AssigneeId"" = @p1
-WHERE ""Id"" IN (@p2, @p3)"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ UPDATE "TodoItems"
+ SET "AssigneeId" = @p1
+ WHERE "Id" IN (@p2, @p3)
+ """));
command.Parameters.ShouldHaveCount(3);
command.Parameters.Should().Contain("@p1", null);
@@ -128,11 +131,12 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[0].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(
- @"SELECT t1.""Id"", t1.""FirstName"", t1.""LastName"", t2.""Id"", t2.""CreatedAt"", t2.""Description"", t2.""DurationInHours"", t2.""LastModifiedAt"", t2.""Priority""
-FROM ""People"" AS t1
-LEFT JOIN ""TodoItems"" AS t2 ON t1.""Id"" = t2.""OwnerId""
-WHERE t1.""Id"" = @p1"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id", t1."FirstName", t1."LastName", t2."Id", t2."CreatedAt", t2."Description", t2."DurationInHours", t2."LastModifiedAt", t2."Priority"
+ FROM "People" AS t1
+ LEFT JOIN "TodoItems" AS t2 ON t1."Id" = t2."OwnerId"
+ WHERE t1."Id" = @p1
+ """));
command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().Contain("@p1", existingPerson.Id);
@@ -140,8 +144,10 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[1].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"DELETE FROM ""TodoItems""
-WHERE ""Id"" IN (@p1, @p2)"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ DELETE FROM "TodoItems"
+ WHERE "Id" IN (@p1, @p2)
+ """));
command.Parameters.ShouldHaveCount(2);
command.Parameters.Should().Contain("@p1", existingPerson.OwnedTodoItems.ElementAt(0).Id);
@@ -207,11 +213,12 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[0].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(
- @"SELECT t1.""Id"", t1.""FirstName"", t1.""LastName"", t2.""Id"", t2.""CreatedAt"", t2.""Description"", t2.""DurationInHours"", t2.""LastModifiedAt"", t2.""Priority""
-FROM ""People"" AS t1
-LEFT JOIN ""TodoItems"" AS t2 ON t1.""Id"" = t2.""AssigneeId""
-WHERE t1.""Id"" = @p1"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id", t1."FirstName", t1."LastName", t2."Id", t2."CreatedAt", t2."Description", t2."DurationInHours", t2."LastModifiedAt", t2."Priority"
+ FROM "People" AS t1
+ LEFT JOIN "TodoItems" AS t2 ON t1."Id" = t2."AssigneeId"
+ WHERE t1."Id" = @p1
+ """));
command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().Contain("@p1", existingPerson.Id);
@@ -219,9 +226,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[1].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"UPDATE ""TodoItems""
-SET ""AssigneeId"" = @p1
-WHERE ""Id"" IN (@p2, @p3)"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ UPDATE "TodoItems"
+ SET "AssigneeId" = @p1
+ WHERE "Id" IN (@p2, @p3)
+ """));
command.Parameters.ShouldHaveCount(3);
command.Parameters.Should().Contain("@p1", existingPerson.Id);
@@ -283,11 +292,12 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[0].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(
- @"SELECT t1.""Id"", t1.""FirstName"", t1.""LastName"", t2.""Id"", t2.""CreatedAt"", t2.""Description"", t2.""DurationInHours"", t2.""LastModifiedAt"", t2.""Priority""
-FROM ""People"" AS t1
-LEFT JOIN ""TodoItems"" AS t2 ON t1.""Id"" = t2.""AssigneeId""
-WHERE t1.""Id"" = @p1"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id", t1."FirstName", t1."LastName", t2."Id", t2."CreatedAt", t2."Description", t2."DurationInHours", t2."LastModifiedAt", t2."Priority"
+ FROM "People" AS t1
+ LEFT JOIN "TodoItems" AS t2 ON t1."Id" = t2."AssigneeId"
+ WHERE t1."Id" = @p1
+ """));
command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().Contain("@p1", existingPerson.Id);
@@ -295,9 +305,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[1].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"UPDATE ""TodoItems""
-SET ""AssigneeId"" = @p1
-WHERE ""Id"" = @p2"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ UPDATE "TodoItems"
+ SET "AssigneeId" = @p1
+ WHERE "Id" = @p2
+ """));
command.Parameters.ShouldHaveCount(2);
command.Parameters.Should().Contain("@p1", null);
@@ -306,9 +318,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[2].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"UPDATE ""TodoItems""
-SET ""AssigneeId"" = @p1
-WHERE ""Id"" = @p2"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ UPDATE "TodoItems"
+ SET "AssigneeId" = @p1
+ WHERE "Id" = @p2
+ """));
command.Parameters.ShouldHaveCount(2);
command.Parameters.Should().Contain("@p1", existingPerson.Id);
@@ -369,11 +383,12 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[0].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(
- @"SELECT t1.""Id"", t1.""FirstName"", t1.""LastName"", t2.""Id"", t2.""CreatedAt"", t2.""Description"", t2.""DurationInHours"", t2.""LastModifiedAt"", t2.""Priority""
-FROM ""People"" AS t1
-LEFT JOIN ""TodoItems"" AS t2 ON t1.""Id"" = t2.""OwnerId""
-WHERE t1.""Id"" = @p1"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id", t1."FirstName", t1."LastName", t2."Id", t2."CreatedAt", t2."Description", t2."DurationInHours", t2."LastModifiedAt", t2."Priority"
+ FROM "People" AS t1
+ LEFT JOIN "TodoItems" AS t2 ON t1."Id" = t2."OwnerId"
+ WHERE t1."Id" = @p1
+ """));
command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().Contain("@p1", existingPerson.Id);
@@ -381,8 +396,10 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[1].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"DELETE FROM ""TodoItems""
-WHERE ""Id"" = @p1"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ DELETE FROM "TodoItems"
+ WHERE "Id" = @p1
+ """));
command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().Contain("@p1", existingPerson.OwnedTodoItems.ElementAt(0).Id);
@@ -390,9 +407,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[2].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"UPDATE ""TodoItems""
-SET ""OwnerId"" = @p1
-WHERE ""Id"" = @p2"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ UPDATE "TodoItems"
+ SET "OwnerId" = @p1
+ WHERE "Id" = @p2
+ """));
command.Parameters.ShouldHaveCount(2);
command.Parameters.Should().Contain("@p1", existingPerson.Id);
diff --git a/test/DapperTests/IntegrationTests/ReadWrite/Relationships/UpdateToOneRelationshipTests.cs b/test/DapperTests/IntegrationTests/ReadWrite/Relationships/UpdateToOneRelationshipTests.cs
index 5ed90caa2a..e42efaf2e1 100644
--- a/test/DapperTests/IntegrationTests/ReadWrite/Relationships/UpdateToOneRelationshipTests.cs
+++ b/test/DapperTests/IntegrationTests/ReadWrite/Relationships/UpdateToOneRelationshipTests.cs
@@ -69,11 +69,12 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[0].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(
- @"SELECT t1.""Id"", t1.""FirstName"", t1.""LastName"", t2.""Id"", t2.""LastUsedAt"", t2.""UserName""
-FROM ""People"" AS t1
-LEFT JOIN ""LoginAccounts"" AS t2 ON t1.""AccountId"" = t2.""Id""
-WHERE t1.""Id"" = @p1"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id", t1."FirstName", t1."LastName", t2."Id", t2."LastUsedAt", t2."UserName"
+ FROM "People" AS t1
+ LEFT JOIN "LoginAccounts" AS t2 ON t1."AccountId" = t2."Id"
+ WHERE t1."Id" = @p1
+ """));
command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().Contain("@p1", existingPerson.Id);
@@ -81,9 +82,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[1].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"UPDATE ""People""
-SET ""AccountId"" = @p1
-WHERE ""Id"" = @p2"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ UPDATE "People"
+ SET "AccountId" = @p1
+ WHERE "Id" = @p2
+ """));
command.Parameters.ShouldHaveCount(2);
command.Parameters.Should().Contain("@p1", null);
@@ -138,11 +141,12 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[0].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(
- @"SELECT t1.""Id"", t1.""LastUsedAt"", t1.""UserName"", t2.""Id"", t2.""FirstName"", t2.""LastName""
-FROM ""LoginAccounts"" AS t1
-LEFT JOIN ""People"" AS t2 ON t1.""Id"" = t2.""AccountId""
-WHERE t1.""Id"" = @p1"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id", t1."LastUsedAt", t1."UserName", t2."Id", t2."FirstName", t2."LastName"
+ FROM "LoginAccounts" AS t1
+ LEFT JOIN "People" AS t2 ON t1."Id" = t2."AccountId"
+ WHERE t1."Id" = @p1
+ """));
command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().Contain("@p1", existingLoginAccount.Id);
@@ -150,9 +154,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[1].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"UPDATE ""People""
-SET ""AccountId"" = @p1
-WHERE ""Id"" = @p2"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ UPDATE "People"
+ SET "AccountId" = @p1
+ WHERE "Id" = @p2
+ """));
command.Parameters.ShouldHaveCount(2);
command.Parameters.Should().Contain("@p1", null);
@@ -194,11 +200,12 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[0].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(
- @"SELECT t1.""Id"", t1.""LastUsedAt"", t1.""UserName"", t2.""Id"", t2.""FirstName"", t2.""LastName""
-FROM ""LoginAccounts"" AS t1
-LEFT JOIN ""People"" AS t2 ON t1.""Id"" = t2.""AccountId""
-WHERE t1.""Id"" = @p1"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id", t1."LastUsedAt", t1."UserName", t2."Id", t2."FirstName", t2."LastName"
+ FROM "LoginAccounts" AS t1
+ LEFT JOIN "People" AS t2 ON t1."Id" = t2."AccountId"
+ WHERE t1."Id" = @p1
+ """));
command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().Contain("@p1", existingLoginAccount.Id);
@@ -245,11 +252,12 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[0].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(
- @"SELECT t1.""Id"", t1.""LastUsedAt"", t1.""UserName"", t2.""Id"", t2.""EmailAddress"", t2.""PhoneNumber""
-FROM ""LoginAccounts"" AS t1
-INNER JOIN ""AccountRecoveries"" AS t2 ON t1.""RecoveryId"" = t2.""Id""
-WHERE t1.""Id"" = @p1"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id", t1."LastUsedAt", t1."UserName", t2."Id", t2."EmailAddress", t2."PhoneNumber"
+ FROM "LoginAccounts" AS t1
+ INNER JOIN "AccountRecoveries" AS t2 ON t1."RecoveryId" = t2."Id"
+ WHERE t1."Id" = @p1
+ """));
command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().Contain("@p1", existingLoginAccount.Id);
@@ -296,11 +304,12 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[0].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(
- @"SELECT t1.""Id"", t1.""EmailAddress"", t1.""PhoneNumber"", t2.""Id"", t2.""LastUsedAt"", t2.""UserName""
-FROM ""AccountRecoveries"" AS t1
-LEFT JOIN ""LoginAccounts"" AS t2 ON t1.""Id"" = t2.""RecoveryId""
-WHERE t1.""Id"" = @p1"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id", t1."EmailAddress", t1."PhoneNumber", t2."Id", t2."LastUsedAt", t2."UserName"
+ FROM "AccountRecoveries" AS t1
+ LEFT JOIN "LoginAccounts" AS t2 ON t1."Id" = t2."RecoveryId"
+ WHERE t1."Id" = @p1
+ """));
command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().Contain("@p1", existingAccountRecovery.Id);
@@ -349,11 +358,12 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[0].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(
- @"SELECT t1.""Id"", t1.""CreatedAt"", t1.""Description"", t1.""DurationInHours"", t1.""LastModifiedAt"", t1.""Priority"", t2.""Id"", t2.""FirstName"", t2.""LastName""
-FROM ""TodoItems"" AS t1
-LEFT JOIN ""People"" AS t2 ON t1.""AssigneeId"" = t2.""Id""
-WHERE t1.""Id"" = @p1"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id", t1."CreatedAt", t1."Description", t1."DurationInHours", t1."LastModifiedAt", t1."Priority", t2."Id", t2."FirstName", t2."LastName"
+ FROM "TodoItems" AS t1
+ LEFT JOIN "People" AS t2 ON t1."AssigneeId" = t2."Id"
+ WHERE t1."Id" = @p1
+ """));
command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().Contain("@p1", existingTodoItem.Id);
@@ -361,9 +371,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[1].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"UPDATE ""TodoItems""
-SET ""AssigneeId"" = @p1
-WHERE ""Id"" = @p2"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ UPDATE "TodoItems"
+ SET "AssigneeId" = @p1
+ WHERE "Id" = @p2
+ """));
command.Parameters.ShouldHaveCount(2);
command.Parameters.Should().Contain("@p1", null);
@@ -411,11 +423,12 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[0].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(
- @"SELECT t1.""Id"", t1.""CreatedAt"", t1.""Description"", t1.""DurationInHours"", t1.""LastModifiedAt"", t1.""Priority"", t2.""Id"", t2.""FirstName"", t2.""LastName""
-FROM ""TodoItems"" AS t1
-INNER JOIN ""People"" AS t2 ON t1.""OwnerId"" = t2.""Id""
-WHERE t1.""Id"" = @p1"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id", t1."CreatedAt", t1."Description", t1."DurationInHours", t1."LastModifiedAt", t1."Priority", t2."Id", t2."FirstName", t2."LastName"
+ FROM "TodoItems" AS t1
+ INNER JOIN "People" AS t2 ON t1."OwnerId" = t2."Id"
+ WHERE t1."Id" = @p1
+ """));
command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().Contain("@p1", existingTodoItem.Id);
@@ -470,11 +483,12 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[0].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(
- @"SELECT t1.""Id"", t1.""FirstName"", t1.""LastName"", t2.""Id"", t2.""LastUsedAt"", t2.""UserName""
-FROM ""People"" AS t1
-LEFT JOIN ""LoginAccounts"" AS t2 ON t1.""AccountId"" = t2.""Id""
-WHERE t1.""Id"" = @p1"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id", t1."FirstName", t1."LastName", t2."Id", t2."LastUsedAt", t2."UserName"
+ FROM "People" AS t1
+ LEFT JOIN "LoginAccounts" AS t2 ON t1."AccountId" = t2."Id"
+ WHERE t1."Id" = @p1
+ """));
command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().Contain("@p1", existingPerson.Id);
@@ -482,9 +496,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[1].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"UPDATE ""People""
-SET ""AccountId"" = @p1
-WHERE ""AccountId"" = @p2"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ UPDATE "People"
+ SET "AccountId" = @p1
+ WHERE "AccountId" = @p2
+ """));
command.Parameters.ShouldHaveCount(2);
command.Parameters.Should().Contain("@p1", null);
@@ -493,9 +509,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[2].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"UPDATE ""People""
-SET ""AccountId"" = @p1
-WHERE ""Id"" = @p2"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ UPDATE "People"
+ SET "AccountId" = @p1
+ WHERE "Id" = @p2
+ """));
command.Parameters.ShouldHaveCount(2);
command.Parameters.Should().Contain("@p1", existingLoginAccount.Id);
@@ -552,11 +570,12 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[0].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(
- @"SELECT t1.""Id"", t1.""LastUsedAt"", t1.""UserName"", t2.""Id"", t2.""FirstName"", t2.""LastName""
-FROM ""LoginAccounts"" AS t1
-LEFT JOIN ""People"" AS t2 ON t1.""Id"" = t2.""AccountId""
-WHERE t1.""Id"" = @p1"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id", t1."LastUsedAt", t1."UserName", t2."Id", t2."FirstName", t2."LastName"
+ FROM "LoginAccounts" AS t1
+ LEFT JOIN "People" AS t2 ON t1."Id" = t2."AccountId"
+ WHERE t1."Id" = @p1
+ """));
command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().Contain("@p1", existingLoginAccount.Id);
@@ -564,9 +583,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[1].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"UPDATE ""People""
-SET ""AccountId"" = @p1
-WHERE ""Id"" = @p2"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ UPDATE "People"
+ SET "AccountId" = @p1
+ WHERE "Id" = @p2
+ """));
command.Parameters.ShouldHaveCount(2);
command.Parameters.Should().Contain("@p1", existingLoginAccount.Id);
@@ -622,11 +643,12 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[0].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(
- @"SELECT t1.""Id"", t1.""CreatedAt"", t1.""Description"", t1.""DurationInHours"", t1.""LastModifiedAt"", t1.""Priority"", t2.""Id"", t2.""FirstName"", t2.""LastName""
-FROM ""TodoItems"" AS t1
-LEFT JOIN ""People"" AS t2 ON t1.""AssigneeId"" = t2.""Id""
-WHERE t1.""Id"" = @p1"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id", t1."CreatedAt", t1."Description", t1."DurationInHours", t1."LastModifiedAt", t1."Priority", t2."Id", t2."FirstName", t2."LastName"
+ FROM "TodoItems" AS t1
+ LEFT JOIN "People" AS t2 ON t1."AssigneeId" = t2."Id"
+ WHERE t1."Id" = @p1
+ """));
command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().Contain("@p1", existingTodoItem.Id);
@@ -634,9 +656,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[1].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"UPDATE ""TodoItems""
-SET ""AssigneeId"" = @p1
-WHERE ""Id"" = @p2"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ UPDATE "TodoItems"
+ SET "AssigneeId" = @p1
+ WHERE "Id" = @p2
+ """));
command.Parameters.ShouldHaveCount(2);
command.Parameters.Should().Contain("@p1", existingPerson.Id);
@@ -699,11 +723,12 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[0].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(
- @"SELECT t1.""Id"", t1.""FirstName"", t1.""LastName"", t2.""Id"", t2.""LastUsedAt"", t2.""UserName""
-FROM ""People"" AS t1
-LEFT JOIN ""LoginAccounts"" AS t2 ON t1.""AccountId"" = t2.""Id""
-WHERE t1.""Id"" = @p1"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id", t1."FirstName", t1."LastName", t2."Id", t2."LastUsedAt", t2."UserName"
+ FROM "People" AS t1
+ LEFT JOIN "LoginAccounts" AS t2 ON t1."AccountId" = t2."Id"
+ WHERE t1."Id" = @p1
+ """));
command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().Contain("@p1", existingPerson1.Id);
@@ -711,9 +736,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[1].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"UPDATE ""People""
-SET ""AccountId"" = @p1
-WHERE ""AccountId"" = @p2"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ UPDATE "People"
+ SET "AccountId" = @p1
+ WHERE "AccountId" = @p2
+ """));
command.Parameters.ShouldHaveCount(2);
command.Parameters.Should().Contain("@p1", null);
@@ -722,9 +749,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[2].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"UPDATE ""People""
-SET ""AccountId"" = @p1
-WHERE ""Id"" = @p2"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ UPDATE "People"
+ SET "AccountId" = @p1
+ WHERE "Id" = @p2
+ """));
command.Parameters.ShouldHaveCount(2);
command.Parameters.Should().Contain("@p1", existingPerson2.Account.Id);
@@ -789,11 +818,12 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[0].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(
- @"SELECT t1.""Id"", t1.""LastUsedAt"", t1.""UserName"", t2.""Id"", t2.""FirstName"", t2.""LastName""
-FROM ""LoginAccounts"" AS t1
-LEFT JOIN ""People"" AS t2 ON t1.""Id"" = t2.""AccountId""
-WHERE t1.""Id"" = @p1"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id", t1."LastUsedAt", t1."UserName", t2."Id", t2."FirstName", t2."LastName"
+ FROM "LoginAccounts" AS t1
+ LEFT JOIN "People" AS t2 ON t1."Id" = t2."AccountId"
+ WHERE t1."Id" = @p1
+ """));
command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().Contain("@p1", existingLoginAccount1.Id);
@@ -801,9 +831,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[1].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"UPDATE ""People""
-SET ""AccountId"" = @p1
-WHERE ""Id"" = @p2"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ UPDATE "People"
+ SET "AccountId" = @p1
+ WHERE "Id" = @p2
+ """));
command.Parameters.ShouldHaveCount(2);
command.Parameters.Should().Contain("@p1", null);
@@ -812,9 +844,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[2].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"UPDATE ""People""
-SET ""AccountId"" = @p1
-WHERE ""Id"" = @p2"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ UPDATE "People"
+ SET "AccountId" = @p1
+ WHERE "Id" = @p2
+ """));
command.Parameters.ShouldHaveCount(2);
command.Parameters.Should().Contain("@p1", existingLoginAccount1.Id);
@@ -877,11 +911,12 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[0].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(
- @"SELECT t1.""Id"", t1.""LastUsedAt"", t1.""UserName"", t2.""Id"", t2.""EmailAddress"", t2.""PhoneNumber""
-FROM ""LoginAccounts"" AS t1
-INNER JOIN ""AccountRecoveries"" AS t2 ON t1.""RecoveryId"" = t2.""Id""
-WHERE t1.""Id"" = @p1"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id", t1."LastUsedAt", t1."UserName", t2."Id", t2."EmailAddress", t2."PhoneNumber"
+ FROM "LoginAccounts" AS t1
+ INNER JOIN "AccountRecoveries" AS t2 ON t1."RecoveryId" = t2."Id"
+ WHERE t1."Id" = @p1
+ """));
command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().Contain("@p1", existingLoginAccount1.Id);
@@ -889,8 +924,10 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[1].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"DELETE FROM ""LoginAccounts""
-WHERE ""RecoveryId"" = @p1"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ DELETE FROM "LoginAccounts"
+ WHERE "RecoveryId" = @p1
+ """));
command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().Contain("@p1", existingLoginAccount2.Recovery.Id);
@@ -898,9 +935,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[2].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"UPDATE ""LoginAccounts""
-SET ""RecoveryId"" = @p1
-WHERE ""Id"" = @p2"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ UPDATE "LoginAccounts"
+ SET "RecoveryId" = @p1
+ WHERE "Id" = @p2
+ """));
command.Parameters.ShouldHaveCount(2);
command.Parameters.Should().Contain("@p1", existingLoginAccount2.Recovery.Id);
@@ -963,11 +1002,12 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[0].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(
- @"SELECT t1.""Id"", t1.""EmailAddress"", t1.""PhoneNumber"", t2.""Id"", t2.""LastUsedAt"", t2.""UserName""
-FROM ""AccountRecoveries"" AS t1
-LEFT JOIN ""LoginAccounts"" AS t2 ON t1.""Id"" = t2.""RecoveryId""
-WHERE t1.""Id"" = @p1"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id", t1."EmailAddress", t1."PhoneNumber", t2."Id", t2."LastUsedAt", t2."UserName"
+ FROM "AccountRecoveries" AS t1
+ LEFT JOIN "LoginAccounts" AS t2 ON t1."Id" = t2."RecoveryId"
+ WHERE t1."Id" = @p1
+ """));
command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().Contain("@p1", existingAccountRecovery1.Id);
@@ -975,8 +1015,10 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[1].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"DELETE FROM ""LoginAccounts""
-WHERE ""Id"" = @p1"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ DELETE FROM "LoginAccounts"
+ WHERE "Id" = @p1
+ """));
command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().Contain("@p1", existingAccountRecovery1.Account.Id);
@@ -984,9 +1026,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[2].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"UPDATE ""LoginAccounts""
-SET ""RecoveryId"" = @p1
-WHERE ""Id"" = @p2"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ UPDATE "LoginAccounts"
+ SET "RecoveryId" = @p1
+ WHERE "Id" = @p2
+ """));
command.Parameters.ShouldHaveCount(2);
command.Parameters.Should().Contain("@p1", existingAccountRecovery1.Id);
@@ -1045,11 +1089,12 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[0].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(
- @"SELECT t1.""Id"", t1.""CreatedAt"", t1.""Description"", t1.""DurationInHours"", t1.""LastModifiedAt"", t1.""Priority"", t2.""Id"", t2.""FirstName"", t2.""LastName""
-FROM ""TodoItems"" AS t1
-LEFT JOIN ""People"" AS t2 ON t1.""AssigneeId"" = t2.""Id""
-WHERE t1.""Id"" = @p1"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id", t1."CreatedAt", t1."Description", t1."DurationInHours", t1."LastModifiedAt", t1."Priority", t2."Id", t2."FirstName", t2."LastName"
+ FROM "TodoItems" AS t1
+ LEFT JOIN "People" AS t2 ON t1."AssigneeId" = t2."Id"
+ WHERE t1."Id" = @p1
+ """));
command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().Contain("@p1", existingTodoItem1.Id);
@@ -1057,9 +1102,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[1].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"UPDATE ""TodoItems""
-SET ""AssigneeId"" = @p1
-WHERE ""Id"" = @p2"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ UPDATE "TodoItems"
+ SET "AssigneeId" = @p1
+ WHERE "Id" = @p2
+ """));
command.Parameters.ShouldHaveCount(2);
command.Parameters.Should().Contain("@p1", existingTodoItem2.Assignee.Id);
@@ -1116,11 +1163,12 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[0].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(
- @"SELECT t1.""Id"", t1.""CreatedAt"", t1.""Description"", t1.""DurationInHours"", t1.""LastModifiedAt"", t1.""Priority"", t2.""Id"", t2.""FirstName"", t2.""LastName""
-FROM ""TodoItems"" AS t1
-INNER JOIN ""People"" AS t2 ON t1.""OwnerId"" = t2.""Id""
-WHERE t1.""Id"" = @p1"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id", t1."CreatedAt", t1."Description", t1."DurationInHours", t1."LastModifiedAt", t1."Priority", t2."Id", t2."FirstName", t2."LastName"
+ FROM "TodoItems" AS t1
+ INNER JOIN "People" AS t2 ON t1."OwnerId" = t2."Id"
+ WHERE t1."Id" = @p1
+ """));
command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().Contain("@p1", existingTodoItem1.Id);
@@ -1128,9 +1176,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[1].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"UPDATE ""TodoItems""
-SET ""OwnerId"" = @p1
-WHERE ""Id"" = @p2"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ UPDATE "TodoItems"
+ SET "OwnerId" = @p1
+ WHERE "Id" = @p2
+ """));
command.Parameters.ShouldHaveCount(2);
command.Parameters.Should().Contain("@p1", existingTodoItem2.Owner.Id);
diff --git a/test/DapperTests/IntegrationTests/ReadWrite/Resources/CreateResourceTests.cs b/test/DapperTests/IntegrationTests/ReadWrite/Resources/CreateResourceTests.cs
index 88ee185132..199c8641e6 100644
--- a/test/DapperTests/IntegrationTests/ReadWrite/Resources/CreateResourceTests.cs
+++ b/test/DapperTests/IntegrationTests/ReadWrite/Resources/CreateResourceTests.cs
@@ -137,10 +137,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[0].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(
- @"INSERT INTO ""TodoItems"" (""Description"", ""Priority"", ""DurationInHours"", ""CreatedAt"", ""LastModifiedAt"", ""OwnerId"", ""AssigneeId"")
-VALUES (@p1, @p2, @p3, @p4, @p5, @p6, @p7)
-RETURNING ""Id"""));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ INSERT INTO "TodoItems" ("Description", "Priority", "DurationInHours", "CreatedAt", "LastModifiedAt", "OwnerId", "AssigneeId")
+ VALUES (@p1, @p2, @p3, @p4, @p5, @p6, @p7)
+ RETURNING "Id"
+ """));
command.Parameters.ShouldHaveCount(7);
command.Parameters.Should().Contain("@p1", newTodoItem.Description);
@@ -154,9 +155,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[1].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"UPDATE ""Tags""
-SET ""TodoItemId"" = @p1
-WHERE ""Id"" = @p2"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ UPDATE "Tags"
+ SET "TodoItemId" = @p1
+ WHERE "Id" = @p2
+ """));
command.Parameters.ShouldHaveCount(2);
command.Parameters.Should().Contain("@p1", newTodoItemId);
@@ -165,10 +168,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[2].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(
- @"SELECT t1.""Id"", t1.""CreatedAt"", t1.""Description"", t1.""DurationInHours"", t1.""LastModifiedAt"", t1.""Priority""
-FROM ""TodoItems"" AS t1
-WHERE t1.""Id"" = @p1"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id", t1."CreatedAt", t1."Description", t1."DurationInHours", t1."LastModifiedAt", t1."Priority"
+ FROM "TodoItems" AS t1
+ WHERE t1."Id" = @p1
+ """));
command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().Contain("@p1", newTodoItemId);
@@ -265,10 +269,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[0].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(
- @"INSERT INTO ""TodoItems"" (""Description"", ""Priority"", ""DurationInHours"", ""CreatedAt"", ""LastModifiedAt"", ""OwnerId"", ""AssigneeId"")
-VALUES (@p1, @p2, @p3, @p4, @p5, @p6, @p7)
-RETURNING ""Id"""));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ INSERT INTO "TodoItems" ("Description", "Priority", "DurationInHours", "CreatedAt", "LastModifiedAt", "OwnerId", "AssigneeId")
+ VALUES (@p1, @p2, @p3, @p4, @p5, @p6, @p7)
+ RETURNING "Id"
+ """));
command.Parameters.ShouldHaveCount(7);
command.Parameters.Should().Contain("@p1", newTodoItem.Description);
@@ -282,10 +287,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[1].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(
- @"SELECT t1.""Id"", t1.""CreatedAt"", t1.""Description"", t1.""DurationInHours"", t1.""LastModifiedAt"", t1.""Priority""
-FROM ""TodoItems"" AS t1
-WHERE t1.""Id"" = @p1"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id", t1."CreatedAt", t1."Description", t1."DurationInHours", t1."LastModifiedAt", t1."Priority"
+ FROM "TodoItems" AS t1
+ WHERE t1."Id" = @p1
+ """));
command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().Contain("@p1", newTodoItemId);
@@ -435,8 +441,10 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[0].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"DELETE FROM ""LoginAccounts""
-WHERE ""RecoveryId"" = @p1"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ DELETE FROM "LoginAccounts"
+ WHERE "RecoveryId" = @p1
+ """));
command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().Contain("@p1", existingAccountRecovery.Id);
@@ -444,9 +452,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[1].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"INSERT INTO ""LoginAccounts"" (""UserName"", ""LastUsedAt"", ""RecoveryId"")
-VALUES (@p1, @p2, @p3)
-RETURNING ""Id"""));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ INSERT INTO "LoginAccounts" ("UserName", "LastUsedAt", "RecoveryId")
+ VALUES (@p1, @p2, @p3)
+ RETURNING "Id"
+ """));
command.Parameters.ShouldHaveCount(3);
command.Parameters.Should().Contain("@p1", newUserName);
@@ -456,9 +466,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[2].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"UPDATE ""People""
-SET ""AccountId"" = @p1
-WHERE ""Id"" = @p2"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ UPDATE "People"
+ SET "AccountId" = @p1
+ WHERE "Id" = @p2
+ """));
command.Parameters.ShouldHaveCount(2);
command.Parameters.Should().Contain("@p1", newLoginAccountId);
@@ -467,9 +479,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[3].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"SELECT t1.""Id"", t1.""LastUsedAt"", t1.""UserName""
-FROM ""LoginAccounts"" AS t1
-WHERE t1.""Id"" = @p1"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id", t1."LastUsedAt", t1."UserName"
+ FROM "LoginAccounts" AS t1
+ WHERE t1."Id" = @p1
+ """));
command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().Contain("@p1", newLoginAccountId);
@@ -528,9 +542,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[0].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"INSERT INTO ""People"" (""FirstName"", ""LastName"", ""AccountId"")
-VALUES (@p1, @p2, @p3)
-RETURNING ""Id"""));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ INSERT INTO "People" ("FirstName", "LastName", "AccountId")
+ VALUES (@p1, @p2, @p3)
+ RETURNING "Id"
+ """));
command.Parameters.ShouldHaveCount(3);
command.Parameters.Should().Contain("@p1", newPerson.FirstName);
@@ -540,9 +556,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[1].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"SELECT t1.""Id"", t1.""FirstName"", t1.""LastName""
-FROM ""People"" AS t1
-WHERE t1.""Id"" = @p1"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id", t1."FirstName", t1."LastName"
+ FROM "People" AS t1
+ WHERE t1."Id" = @p1
+ """));
command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().Contain("@p1", newPersonId);
@@ -613,8 +631,10 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[0].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"DELETE FROM ""RgbColors""
-WHERE ""TagId"" = @p1"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ DELETE FROM "RgbColors"
+ WHERE "TagId" = @p1
+ """));
command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().Contain("@p1", existingTag.Id);
@@ -622,9 +642,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[1].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"INSERT INTO ""RgbColors"" (""Id"", ""TagId"")
-VALUES (@p1, @p2)
-RETURNING ""Id""", true));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ INSERT INTO "RgbColors" ("Id", "TagId")
+ VALUES (@p1, @p2)
+ RETURNING "Id"
+ """, true));
command.Parameters.ShouldHaveCount(2);
command.Parameters.Should().Contain("@p1", newColor.Id);
@@ -633,9 +655,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[2].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"SELECT t1.""Id""
-FROM ""RgbColors"" AS t1
-WHERE t1.""Id"" = @p1"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id"
+ FROM "RgbColors" AS t1
+ WHERE t1."Id" = @p1
+ """));
command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().Contain("@p1", newColor.Id);
@@ -701,8 +725,10 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[0].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"DELETE FROM ""RgbColors""
-WHERE ""TagId"" = @p1"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ DELETE FROM "RgbColors"
+ WHERE "TagId" = @p1
+ """));
command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().Contain("@p1", existingTag.Id);
@@ -710,9 +736,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[1].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"INSERT INTO ""RgbColors"" (""Id"", ""TagId"")
-VALUES (@p1, @p2)
-RETURNING ""Id""", true));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ INSERT INTO "RgbColors" ("Id", "TagId")
+ VALUES (@p1, @p2)
+ RETURNING "Id"
+ """, true));
command.Parameters.ShouldHaveCount(2);
command.Parameters.Should().Contain("@p1", existingColor.Id);
@@ -721,9 +749,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[2].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"SELECT t1.""Id""
-FROM ""RgbColors"" AS t1
-WHERE t1.""Id"" = @p1"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id"
+ FROM "RgbColors" AS t1
+ WHERE t1."Id" = @p1
+ """));
command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().Contain("@p1", existingColor.Id);
diff --git a/test/DapperTests/IntegrationTests/ReadWrite/Resources/DeleteResourceTests.cs b/test/DapperTests/IntegrationTests/ReadWrite/Resources/DeleteResourceTests.cs
index 94f6d17b60..af81d138a6 100644
--- a/test/DapperTests/IntegrationTests/ReadWrite/Resources/DeleteResourceTests.cs
+++ b/test/DapperTests/IntegrationTests/ReadWrite/Resources/DeleteResourceTests.cs
@@ -66,8 +66,10 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[0].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"DELETE FROM ""TodoItems""
-WHERE ""Id"" = @p1"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ DELETE FROM "TodoItems"
+ WHERE "Id" = @p1
+ """));
command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().Contain("@p1", existingTodoItem.Id);
@@ -103,8 +105,10 @@ public async Task Cannot_delete_unknown_resource()
store.SqlCommands[0].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"DELETE FROM ""TodoItems""
-WHERE ""Id"" = @p1"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ DELETE FROM "TodoItems"
+ WHERE "Id" = @p1
+ """));
command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().Contain("@p1", unknownTodoItemId);
@@ -112,9 +116,11 @@ public async Task Cannot_delete_unknown_resource()
store.SqlCommands[1].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"SELECT t1.""Id""
-FROM ""TodoItems"" AS t1
-WHERE t1.""Id"" = @p1"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id"
+ FROM "TodoItems" AS t1
+ WHERE t1."Id" = @p1
+ """));
command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().Contain("@p1", unknownTodoItemId);
diff --git a/test/DapperTests/IntegrationTests/ReadWrite/Resources/FetchResourceTests.cs b/test/DapperTests/IntegrationTests/ReadWrite/Resources/FetchResourceTests.cs
index 327a0b3051..0027de1d38 100644
--- a/test/DapperTests/IntegrationTests/ReadWrite/Resources/FetchResourceTests.cs
+++ b/test/DapperTests/IntegrationTests/ReadWrite/Resources/FetchResourceTests.cs
@@ -74,18 +74,21 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[0].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"SELECT COUNT(*)
-FROM ""TodoItems"" AS t1"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT COUNT(*)
+ FROM "TodoItems" AS t1
+ """));
command.Parameters.Should().BeEmpty();
});
store.SqlCommands[1].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(
- @"SELECT t1.""Id"", t1.""CreatedAt"", t1.""Description"", t1.""DurationInHours"", t1.""LastModifiedAt"", t1.""Priority""
-FROM ""TodoItems"" AS t1
-ORDER BY t1.""Priority"", t1.""LastModifiedAt"" DESC"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id", t1."CreatedAt", t1."Description", t1."DurationInHours", t1."LastModifiedAt", t1."Priority"
+ FROM "TodoItems" AS t1
+ ORDER BY t1."Priority", t1."LastModifiedAt" DESC
+ """));
command.Parameters.Should().BeEmpty();
});
@@ -131,10 +134,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[0].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(
- @"SELECT t1.""Id"", t1.""CreatedAt"", t1.""Description"", t1.""DurationInHours"", t1.""LastModifiedAt"", t1.""Priority""
-FROM ""TodoItems"" AS t1
-WHERE t1.""Id"" = @p1"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id", t1."CreatedAt", t1."Description", t1."DurationInHours", t1."LastModifiedAt", t1."Priority"
+ FROM "TodoItems" AS t1
+ WHERE t1."Id" = @p1
+ """));
command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().Contain("@p1", todoItem.Id);
@@ -170,10 +174,11 @@ public async Task Cannot_get_unknown_primary_resource_by_ID()
store.SqlCommands[0].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(
- @"SELECT t1.""Id"", t1.""CreatedAt"", t1.""Description"", t1.""DurationInHours"", t1.""LastModifiedAt"", t1.""Priority""
-FROM ""TodoItems"" AS t1
-WHERE t1.""Id"" = @p1"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id", t1."CreatedAt", t1."Description", t1."DurationInHours", t1."LastModifiedAt", t1."Priority"
+ FROM "TodoItems" AS t1
+ WHERE t1."Id" = @p1
+ """));
command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().Contain("@p1", unknownTodoItemId);
@@ -223,10 +228,12 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[0].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"SELECT COUNT(*)
-FROM ""Tags"" AS t1
-LEFT JOIN ""TodoItems"" AS t2 ON t1.""TodoItemId"" = t2.""Id""
-WHERE t2.""Id"" = @p1"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT COUNT(*)
+ FROM "Tags" AS t1
+ LEFT JOIN "TodoItems" AS t2 ON t1."TodoItemId" = t2."Id"
+ WHERE t2."Id" = @p1
+ """));
command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().Contain("@p1", todoItem.Id);
@@ -234,11 +241,13 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[1].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"SELECT t1.""Id"", t2.""Id"", t2.""Name""
-FROM ""TodoItems"" AS t1
-LEFT JOIN ""Tags"" AS t2 ON t1.""Id"" = t2.""TodoItemId""
-WHERE t1.""Id"" = @p1
-ORDER BY t2.""Id"""));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id", t2."Id", t2."Name"
+ FROM "TodoItems" AS t1
+ LEFT JOIN "Tags" AS t2 ON t1."Id" = t2."TodoItemId"
+ WHERE t1."Id" = @p1
+ ORDER BY t2."Id"
+ """));
command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().Contain("@p1", todoItem.Id);
@@ -283,10 +292,12 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[0].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"SELECT t1.""Id"", t2.""Id"", t2.""FirstName"", t2.""LastName""
-FROM ""TodoItems"" AS t1
-INNER JOIN ""People"" AS t2 ON t1.""OwnerId"" = t2.""Id""
-WHERE t1.""Id"" = @p1"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id", t2."Id", t2."FirstName", t2."LastName"
+ FROM "TodoItems" AS t1
+ INNER JOIN "People" AS t2 ON t1."OwnerId" = t2."Id"
+ WHERE t1."Id" = @p1
+ """));
command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().Contain("@p1", todoItem.Id);
@@ -325,10 +336,12 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[0].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"SELECT t1.""Id"", t2.""Id"", t2.""FirstName"", t2.""LastName""
-FROM ""TodoItems"" AS t1
-LEFT JOIN ""People"" AS t2 ON t1.""AssigneeId"" = t2.""Id""
-WHERE t1.""Id"" = @p1"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id", t2."Id", t2."FirstName", t2."LastName"
+ FROM "TodoItems" AS t1
+ LEFT JOIN "People" AS t2 ON t1."AssigneeId" = t2."Id"
+ WHERE t1."Id" = @p1
+ """));
command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().Contain("@p1", todoItem.Id);
diff --git a/test/DapperTests/IntegrationTests/ReadWrite/Resources/UpdateResourceTests.cs b/test/DapperTests/IntegrationTests/ReadWrite/Resources/UpdateResourceTests.cs
index 7ac11df3c9..f51b7c6b52 100644
--- a/test/DapperTests/IntegrationTests/ReadWrite/Resources/UpdateResourceTests.cs
+++ b/test/DapperTests/IntegrationTests/ReadWrite/Resources/UpdateResourceTests.cs
@@ -77,9 +77,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[0].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"SELECT t1.""Id"", t1.""Name""
-FROM ""Tags"" AS t1
-WHERE t1.""Id"" = @p1"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id", t1."Name"
+ FROM "Tags" AS t1
+ WHERE t1."Id" = @p1
+ """));
command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().Contain("@p1", existingTag.Id);
@@ -87,9 +89,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[1].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"SELECT t1.""Id"", t1.""Name""
-FROM ""Tags"" AS t1
-WHERE t1.""Id"" = @p1"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id", t1."Name"
+ FROM "Tags" AS t1
+ WHERE t1."Id" = @p1
+ """));
command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().Contain("@p1", existingTag.Id);
@@ -181,10 +185,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[0].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(
- @"SELECT t1.""Id"", t1.""CreatedAt"", t1.""Description"", t1.""DurationInHours"", t1.""LastModifiedAt"", t1.""Priority""
-FROM ""TodoItems"" AS t1
-WHERE t1.""Id"" = @p1"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id", t1."CreatedAt", t1."Description", t1."DurationInHours", t1."LastModifiedAt", t1."Priority"
+ FROM "TodoItems" AS t1
+ WHERE t1."Id" = @p1
+ """));
command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().Contain("@p1", existingTodoItem.Id);
@@ -192,9 +197,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[1].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"UPDATE ""TodoItems""
-SET ""Description"" = @p1, ""DurationInHours"" = @p2, ""LastModifiedAt"" = @p3
-WHERE ""Id"" = @p4"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ UPDATE "TodoItems"
+ SET "Description" = @p1, "DurationInHours" = @p2, "LastModifiedAt" = @p3
+ WHERE "Id" = @p4
+ """));
command.Parameters.ShouldHaveCount(4);
command.Parameters.Should().Contain("@p1", newDescription);
@@ -205,10 +212,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[2].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(
- @"SELECT t1.""Id"", t1.""CreatedAt"", t1.""Description"", t1.""DurationInHours"", t1.""LastModifiedAt"", t1.""Priority""
-FROM ""TodoItems"" AS t1
-WHERE t1.""Id"" = @p1"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id", t1."CreatedAt", t1."Description", t1."DurationInHours", t1."LastModifiedAt", t1."Priority"
+ FROM "TodoItems" AS t1
+ WHERE t1."Id" = @p1
+ """));
command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().Contain("@p1", existingTodoItem.Id);
@@ -334,13 +342,14 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[0].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(
- @"SELECT t1.""Id"", t1.""CreatedAt"", t1.""Description"", t1.""DurationInHours"", t1.""LastModifiedAt"", t1.""Priority"", t2.""Id"", t2.""FirstName"", t2.""LastName"", t3.""Id"", t3.""FirstName"", t3.""LastName"", t4.""Id"", t4.""Name""
-FROM ""TodoItems"" AS t1
-LEFT JOIN ""People"" AS t2 ON t1.""AssigneeId"" = t2.""Id""
-INNER JOIN ""People"" AS t3 ON t1.""OwnerId"" = t3.""Id""
-LEFT JOIN ""Tags"" AS t4 ON t1.""Id"" = t4.""TodoItemId""
-WHERE t1.""Id"" = @p1"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id", t1."CreatedAt", t1."Description", t1."DurationInHours", t1."LastModifiedAt", t1."Priority", t2."Id", t2."FirstName", t2."LastName", t3."Id", t3."FirstName", t3."LastName", t4."Id", t4."Name"
+ FROM "TodoItems" AS t1
+ LEFT JOIN "People" AS t2 ON t1."AssigneeId" = t2."Id"
+ INNER JOIN "People" AS t3 ON t1."OwnerId" = t3."Id"
+ LEFT JOIN "Tags" AS t4 ON t1."Id" = t4."TodoItemId"
+ WHERE t1."Id" = @p1
+ """));
command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().Contain("@p1", existingTodoItem.Id);
@@ -348,9 +357,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[1].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"UPDATE ""TodoItems""
-SET ""Description"" = @p1, ""Priority"" = @p2, ""DurationInHours"" = @p3, ""LastModifiedAt"" = @p4, ""OwnerId"" = @p5, ""AssigneeId"" = @p6
-WHERE ""Id"" = @p7"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ UPDATE "TodoItems"
+ SET "Description" = @p1, "Priority" = @p2, "DurationInHours" = @p3, "LastModifiedAt" = @p4, "OwnerId" = @p5, "AssigneeId" = @p6
+ WHERE "Id" = @p7
+ """));
command.Parameters.ShouldHaveCount(7);
command.Parameters.Should().Contain("@p1", newTodoItem.Description);
@@ -364,9 +375,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[2].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"UPDATE ""Tags""
-SET ""TodoItemId"" = @p1
-WHERE ""Id"" IN (@p2, @p3)"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ UPDATE "Tags"
+ SET "TodoItemId" = @p1
+ WHERE "Id" IN (@p2, @p3)
+ """));
command.Parameters.ShouldHaveCount(3);
command.Parameters.Should().Contain("@p1", null);
@@ -376,9 +389,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[3].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"UPDATE ""Tags""
-SET ""TodoItemId"" = @p1
-WHERE ""Id"" = @p2"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ UPDATE "Tags"
+ SET "TodoItemId" = @p1
+ WHERE "Id" = @p2
+ """));
command.Parameters.ShouldHaveCount(2);
command.Parameters.Should().Contain("@p1", existingTodoItem.Id);
@@ -387,10 +402,11 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[4].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(
- @"SELECT t1.""Id"", t1.""CreatedAt"", t1.""Description"", t1.""DurationInHours"", t1.""LastModifiedAt"", t1.""Priority""
-FROM ""TodoItems"" AS t1
-WHERE t1.""Id"" = @p1"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id", t1."CreatedAt", t1."Description", t1."DurationInHours", t1."LastModifiedAt", t1."Priority"
+ FROM "TodoItems" AS t1
+ WHERE t1."Id" = @p1
+ """));
command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().Contain("@p1", existingTodoItem.Id);
diff --git a/test/DapperTests/IntegrationTests/Sql/SubQueryInJoinTests.cs b/test/DapperTests/IntegrationTests/Sql/SubQueryInJoinTests.cs
index 235ec91f2a..ed75d24d65 100644
--- a/test/DapperTests/IntegrationTests/Sql/SubQueryInJoinTests.cs
+++ b/test/DapperTests/IntegrationTests/Sql/SubQueryInJoinTests.cs
@@ -48,19 +48,22 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[0].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"SELECT COUNT(*)
-FROM ""People"" AS t1"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT COUNT(*)
+ FROM "People" AS t1
+ """));
command.Parameters.Should().BeEmpty();
});
store.SqlCommands[1].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(
- @"SELECT t1.""Id"", t1.""FirstName"", t1.""LastName"", t2.""Id"", t2.""LastUsedAt"", t2.""UserName""
-FROM ""People"" AS t1
-LEFT JOIN ""LoginAccounts"" AS t2 ON t1.""AccountId"" = t2.""Id""
-ORDER BY t1.""Id"""));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id", t1."FirstName", t1."LastName", t2."Id", t2."LastUsedAt", t2."UserName"
+ FROM "People" AS t1
+ LEFT JOIN "LoginAccounts" AS t2 ON t1."AccountId" = t2."Id"
+ ORDER BY t1."Id"
+ """));
command.Parameters.Should().BeEmpty();
});
@@ -94,19 +97,22 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[0].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"SELECT COUNT(*)
-FROM ""People"" AS t1"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT COUNT(*)
+ FROM "People" AS t1
+ """));
command.Parameters.Should().BeEmpty();
});
store.SqlCommands[1].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(
- @"SELECT t1.""Id"", t1.""FirstName"", t1.""LastName"", t2.""Id"", t2.""CreatedAt"", t2.""Description"", t2.""DurationInHours"", t2.""LastModifiedAt"", t2.""Priority""
-FROM ""People"" AS t1
-LEFT JOIN ""TodoItems"" AS t2 ON t1.""Id"" = t2.""OwnerId""
-ORDER BY t1.""Id"", t2.""Priority"", t2.""LastModifiedAt"" DESC"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id", t1."FirstName", t1."LastName", t2."Id", t2."CreatedAt", t2."Description", t2."DurationInHours", t2."LastModifiedAt", t2."Priority"
+ FROM "People" AS t1
+ LEFT JOIN "TodoItems" AS t2 ON t1."Id" = t2."OwnerId"
+ ORDER BY t1."Id", t2."Priority", t2."LastModifiedAt" DESC
+ """));
command.Parameters.Should().BeEmpty();
});
@@ -140,19 +146,22 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[0].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"SELECT COUNT(*)
-FROM ""People"" AS t1"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT COUNT(*)
+ FROM "People" AS t1
+ """));
command.Parameters.Should().BeEmpty();
});
store.SqlCommands[1].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(
- @"SELECT t1.""Id"", t1.""FirstName"", t1.""LastName"", t2.""Id"", t2.""CreatedAt"", t2.""Description"", t2.""DurationInHours"", t2.""LastModifiedAt"", t2.""Priority""
-FROM ""People"" AS t1
-LEFT JOIN ""TodoItems"" AS t2 ON t1.""Id"" = t2.""OwnerId""
-ORDER BY t1.""Id"", t2.""Description"""));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id", t1."FirstName", t1."LastName", t2."Id", t2."CreatedAt", t2."Description", t2."DurationInHours", t2."LastModifiedAt", t2."Priority"
+ FROM "People" AS t1
+ LEFT JOIN "TodoItems" AS t2 ON t1."Id" = t2."OwnerId"
+ ORDER BY t1."Id", t2."Description"
+ """));
command.Parameters.Should().BeEmpty();
});
@@ -186,23 +195,26 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[0].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"SELECT COUNT(*)
-FROM ""People"" AS t1"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT COUNT(*)
+ FROM "People" AS t1
+ """));
command.Parameters.Should().BeEmpty();
});
store.SqlCommands[1].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(
- @"SELECT t1.""Id"", t1.""FirstName"", t1.""LastName"", t2.""Id"", t2.""CreatedAt"", t2.""Description"", t2.""DurationInHours"", t2.""LastModifiedAt"", t2.""Priority""
-FROM ""People"" AS t1
-LEFT JOIN ""TodoItems"" AS t2 ON t1.""Id"" = t2.""OwnerId""
-ORDER BY t1.""Id"", (
- SELECT COUNT(*)
- FROM ""Tags"" AS t3
- WHERE t2.""Id"" = t3.""TodoItemId""
-)"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id", t1."FirstName", t1."LastName", t2."Id", t2."CreatedAt", t2."Description", t2."DurationInHours", t2."LastModifiedAt", t2."Priority"
+ FROM "People" AS t1
+ LEFT JOIN "TodoItems" AS t2 ON t1."Id" = t2."OwnerId"
+ ORDER BY t1."Id", (
+ SELECT COUNT(*)
+ FROM "Tags" AS t3
+ WHERE t2."Id" = t3."TodoItemId"
+ )
+ """));
command.Parameters.Should().BeEmpty();
});
@@ -236,24 +248,27 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[0].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"SELECT COUNT(*)
-FROM ""People"" AS t1"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT COUNT(*)
+ FROM "People" AS t1
+ """));
command.Parameters.Should().BeEmpty();
});
store.SqlCommands[1].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(
- @"SELECT t1.""Id"", t1.""FirstName"", t1.""LastName"", t2.""Id"", t2.""CreatedAt"", t2.""Description"", t2.""DurationInHours"", t2.""LastModifiedAt"", t2.""Priority"", t4.""Id"", t4.""Name""
-FROM ""People"" AS t1
-LEFT JOIN ""TodoItems"" AS t2 ON t1.""Id"" = t2.""OwnerId""
-LEFT JOIN ""Tags"" AS t4 ON t2.""Id"" = t4.""TodoItemId""
-ORDER BY t1.""Id"", (
- SELECT COUNT(*)
- FROM ""Tags"" AS t3
- WHERE t2.""Id"" = t3.""TodoItemId""
-), t4.""Name"" DESC"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id", t1."FirstName", t1."LastName", t2."Id", t2."CreatedAt", t2."Description", t2."DurationInHours", t2."LastModifiedAt", t2."Priority", t4."Id", t4."Name"
+ FROM "People" AS t1
+ LEFT JOIN "TodoItems" AS t2 ON t1."Id" = t2."OwnerId"
+ LEFT JOIN "Tags" AS t4 ON t2."Id" = t4."TodoItemId"
+ ORDER BY t1."Id", (
+ SELECT COUNT(*)
+ FROM "Tags" AS t3
+ WHERE t2."Id" = t3."TodoItemId"
+ ), t4."Name" DESC
+ """));
command.Parameters.Should().BeEmpty();
});
@@ -289,31 +304,34 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[0].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"SELECT COUNT(*)
-FROM ""TodoItems"" AS t1"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT COUNT(*)
+ FROM "TodoItems" AS t1
+ """));
command.Parameters.Should().BeEmpty();
});
store.SqlCommands[1].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(
- @"SELECT t1.""Id"", t1.""CreatedAt"", t1.""Description"", t1.""DurationInHours"", t1.""LastModifiedAt"", t1.""Priority"", t2.""Id"", t2.""FirstName"", t2.""LastName"", t3.""Id"", t3.""CreatedAt"", t3.""Description"", t3.""DurationInHours"", t3.""LastModifiedAt"", t3.""Priority"", t5.""Id"", t5.""Name"", t6.""Id"", t6.""CreatedAt"", t6.""Description"", t6.""DurationInHours"", t6.""LastModifiedAt"", t6.""Priority"", t8.""Id"", t8.""Name""
-FROM ""TodoItems"" AS t1
-INNER JOIN ""People"" AS t2 ON t1.""OwnerId"" = t2.""Id""
-LEFT JOIN ""TodoItems"" AS t3 ON t2.""Id"" = t3.""AssigneeId""
-LEFT JOIN ""Tags"" AS t5 ON t3.""Id"" = t5.""TodoItemId""
-LEFT JOIN ""TodoItems"" AS t6 ON t2.""Id"" = t6.""OwnerId""
-LEFT JOIN ""Tags"" AS t8 ON t6.""Id"" = t8.""TodoItemId""
-ORDER BY t1.""Priority"", t1.""LastModifiedAt"" DESC, (
- SELECT COUNT(*)
- FROM ""Tags"" AS t4
- WHERE t3.""Id"" = t4.""TodoItemId""
-), t5.""Id"", (
- SELECT COUNT(*)
- FROM ""Tags"" AS t7
- WHERE t6.""Id"" = t7.""TodoItemId""
-), t8.""Id"""));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id", t1."CreatedAt", t1."Description", t1."DurationInHours", t1."LastModifiedAt", t1."Priority", t2."Id", t2."FirstName", t2."LastName", t3."Id", t3."CreatedAt", t3."Description", t3."DurationInHours", t3."LastModifiedAt", t3."Priority", t5."Id", t5."Name", t6."Id", t6."CreatedAt", t6."Description", t6."DurationInHours", t6."LastModifiedAt", t6."Priority", t8."Id", t8."Name"
+ FROM "TodoItems" AS t1
+ INNER JOIN "People" AS t2 ON t1."OwnerId" = t2."Id"
+ LEFT JOIN "TodoItems" AS t3 ON t2."Id" = t3."AssigneeId"
+ LEFT JOIN "Tags" AS t5 ON t3."Id" = t5."TodoItemId"
+ LEFT JOIN "TodoItems" AS t6 ON t2."Id" = t6."OwnerId"
+ LEFT JOIN "Tags" AS t8 ON t6."Id" = t8."TodoItemId"
+ ORDER BY t1."Priority", t1."LastModifiedAt" DESC, (
+ SELECT COUNT(*)
+ FROM "Tags" AS t4
+ WHERE t3."Id" = t4."TodoItemId"
+ ), t5."Id", (
+ SELECT COUNT(*)
+ FROM "Tags" AS t7
+ WHERE t6."Id" = t7."TodoItemId"
+ ), t8."Id"
+ """));
command.Parameters.Should().BeEmpty();
});
@@ -347,23 +365,26 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[0].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"SELECT COUNT(*)
-FROM ""People"" AS t1"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT COUNT(*)
+ FROM "People" AS t1
+ """));
command.Parameters.Should().BeEmpty();
});
store.SqlCommands[1].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(
- @"SELECT t1.""Id"", t1.""FirstName"", t1.""LastName"", t3.""Id"", t3.""CreatedAt"", t3.""Description"", t3.""DurationInHours"", t3.""LastModifiedAt"", t3.""Priority""
-FROM ""People"" AS t1
-LEFT JOIN (
- SELECT t2.""Id"", t2.""CreatedAt"", t2.""Description"", t2.""DurationInHours"", t2.""LastModifiedAt"", t2.""OwnerId"", t2.""Priority""
- FROM ""TodoItems"" AS t2
- WHERE t2.""Description"" = @p1
-) AS t3 ON t1.""Id"" = t3.""OwnerId""
-ORDER BY t1.""Id"", t3.""Priority"", t3.""LastModifiedAt"" DESC"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id", t1."FirstName", t1."LastName", t3."Id", t3."CreatedAt", t3."Description", t3."DurationInHours", t3."LastModifiedAt", t3."Priority"
+ FROM "People" AS t1
+ LEFT JOIN (
+ SELECT t2."Id", t2."CreatedAt", t2."Description", t2."DurationInHours", t2."LastModifiedAt", t2."OwnerId", t2."Priority"
+ FROM "TodoItems" AS t2
+ WHERE t2."Description" = @p1
+ ) AS t3 ON t1."Id" = t3."OwnerId"
+ ORDER BY t1."Id", t3."Priority", t3."LastModifiedAt" DESC
+ """));
command.Parameters.Should().HaveCount(1);
command.Parameters.Should().Contain("@p1", "X");
@@ -398,27 +419,30 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[0].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"SELECT COUNT(*)
-FROM ""People"" AS t1"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT COUNT(*)
+ FROM "People" AS t1
+ """));
command.Parameters.Should().BeEmpty();
});
store.SqlCommands[1].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(
- @"SELECT t1.""Id"", t1.""FirstName"", t1.""LastName"", t4.""Id"", t4.""CreatedAt"", t4.""Description"", t4.""DurationInHours"", t4.""LastModifiedAt"", t4.""Priority""
-FROM ""People"" AS t1
-LEFT JOIN (
- SELECT t2.""Id"", t2.""CreatedAt"", t2.""Description"", t2.""DurationInHours"", t2.""LastModifiedAt"", t2.""OwnerId"", t2.""Priority""
- FROM ""TodoItems"" AS t2
- WHERE EXISTS (
- SELECT 1
- FROM ""Tags"" AS t3
- WHERE t2.""Id"" = t3.""TodoItemId""
- )
-) AS t4 ON t1.""Id"" = t4.""OwnerId""
-ORDER BY t1.""Id"", t4.""Priority"", t4.""LastModifiedAt"" DESC"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id", t1."FirstName", t1."LastName", t4."Id", t4."CreatedAt", t4."Description", t4."DurationInHours", t4."LastModifiedAt", t4."Priority"
+ FROM "People" AS t1
+ LEFT JOIN (
+ SELECT t2."Id", t2."CreatedAt", t2."Description", t2."DurationInHours", t2."LastModifiedAt", t2."OwnerId", t2."Priority"
+ FROM "TodoItems" AS t2
+ WHERE EXISTS (
+ SELECT 1
+ FROM "Tags" AS t3
+ WHERE t2."Id" = t3."TodoItemId"
+ )
+ ) AS t4 ON t1."Id" = t4."OwnerId"
+ ORDER BY t1."Id", t4."Priority", t4."LastModifiedAt" DESC
+ """));
command.Parameters.Should().BeEmpty();
});
@@ -452,27 +476,30 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[0].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"SELECT COUNT(*)
-FROM ""People"" AS t1"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT COUNT(*)
+ FROM "People" AS t1
+ """));
command.Parameters.Should().BeEmpty();
});
store.SqlCommands[1].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(
- @"SELECT t1.""Id"", t1.""FirstName"", t1.""LastName"", t4.""Id"", t4.""CreatedAt"", t4.""Description"", t4.""DurationInHours"", t4.""LastModifiedAt"", t4.""Priority""
-FROM ""People"" AS t1
-LEFT JOIN (
- SELECT t2.""Id"", t2.""CreatedAt"", t2.""Description"", t2.""DurationInHours"", t2.""LastModifiedAt"", t2.""OwnerId"", t2.""Priority""
- FROM ""TodoItems"" AS t2
- WHERE (
- SELECT COUNT(*)
- FROM ""Tags"" AS t3
- WHERE t2.""Id"" = t3.""TodoItemId""
- ) > @p1
-) AS t4 ON t1.""Id"" = t4.""OwnerId""
-ORDER BY t1.""Id"", t4.""Priority"", t4.""LastModifiedAt"" DESC"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id", t1."FirstName", t1."LastName", t4."Id", t4."CreatedAt", t4."Description", t4."DurationInHours", t4."LastModifiedAt", t4."Priority"
+ FROM "People" AS t1
+ LEFT JOIN (
+ SELECT t2."Id", t2."CreatedAt", t2."Description", t2."DurationInHours", t2."LastModifiedAt", t2."OwnerId", t2."Priority"
+ FROM "TodoItems" AS t2
+ WHERE (
+ SELECT COUNT(*)
+ FROM "Tags" AS t3
+ WHERE t2."Id" = t3."TodoItemId"
+ ) > @p1
+ ) AS t4 ON t1."Id" = t4."OwnerId"
+ ORDER BY t1."Id", t4."Priority", t4."LastModifiedAt" DESC
+ """));
command.Parameters.Should().HaveCount(1);
command.Parameters.Should().Contain("@p1", 0);
@@ -508,28 +535,31 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[0].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"SELECT COUNT(*)
-FROM ""People"" AS t1"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT COUNT(*)
+ FROM "People" AS t1
+ """));
command.Parameters.Should().BeEmpty();
});
store.SqlCommands[1].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(
- @"SELECT t1.""Id"", t1.""FirstName"", t1.""LastName"", t5.""Id"", t5.""CreatedAt"", t5.""Description"", t5.""DurationInHours"", t5.""LastModifiedAt"", t5.""Priority"", t5.Id0 AS Id, t5.""Name""
-FROM ""People"" AS t1
-LEFT JOIN (
- SELECT t2.""Id"", t2.""CreatedAt"", t2.""Description"", t2.""DurationInHours"", t2.""LastModifiedAt"", t2.""OwnerId"", t2.""Priority"", t4.""Id"" AS Id0, t4.""Name""
- FROM ""TodoItems"" AS t2
- LEFT JOIN ""Tags"" AS t4 ON t2.""Id"" = t4.""TodoItemId""
- WHERE t2.""Description"" = @p1
-) AS t5 ON t1.""Id"" = t5.""OwnerId""
-ORDER BY t1.""Id"", (
- SELECT COUNT(*)
- FROM ""Tags"" AS t3
- WHERE t5.""Id"" = t3.""TodoItemId""
-), t5.""Name"" DESC"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id", t1."FirstName", t1."LastName", t5."Id", t5."CreatedAt", t5."Description", t5."DurationInHours", t5."LastModifiedAt", t5."Priority", t5.Id0 AS Id, t5."Name"
+ FROM "People" AS t1
+ LEFT JOIN (
+ SELECT t2."Id", t2."CreatedAt", t2."Description", t2."DurationInHours", t2."LastModifiedAt", t2."OwnerId", t2."Priority", t4."Id" AS Id0, t4."Name"
+ FROM "TodoItems" AS t2
+ LEFT JOIN "Tags" AS t4 ON t2."Id" = t4."TodoItemId"
+ WHERE t2."Description" = @p1
+ ) AS t5 ON t1."Id" = t5."OwnerId"
+ ORDER BY t1."Id", (
+ SELECT COUNT(*)
+ FROM "Tags" AS t3
+ WHERE t5."Id" = t3."TodoItemId"
+ ), t5."Name" DESC
+ """));
command.Parameters.Should().HaveCount(1);
command.Parameters.Should().Contain("@p1", "X");
@@ -566,33 +596,36 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
store.SqlCommands[0].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(@"SELECT COUNT(*)
-FROM ""People"" AS t1"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT COUNT(*)
+ FROM "People" AS t1
+ """));
command.Parameters.Should().BeEmpty();
});
store.SqlCommands[1].With(command =>
{
- command.Statement.Should().Be(_testContext.AdaptSql(
- @"SELECT t1.""Id"", t1.""FirstName"", t1.""LastName"", t7.""Id"", t7.""CreatedAt"", t7.""Description"", t7.""DurationInHours"", t7.""LastModifiedAt"", t7.""Priority"", t7.Id00 AS Id, t7.""Name""
-FROM ""People"" AS t1
-LEFT JOIN (
- SELECT t2.""Id"", t2.""CreatedAt"", t2.""Description"", t2.""DurationInHours"", t2.""LastModifiedAt"", t2.""OwnerId"", t2.""Priority"", t4.""LastName"", t6.""Id"" AS Id00, t6.""Name""
- FROM ""TodoItems"" AS t2
- LEFT JOIN ""People"" AS t4 ON t2.""AssigneeId"" = t4.""Id""
- LEFT JOIN (
- SELECT t5.""Id"", t5.""Name"", t5.""TodoItemId""
- FROM ""Tags"" AS t5
- WHERE NOT (t5.""Name"" = @p2)
- ) AS t6 ON t2.""Id"" = t6.""TodoItemId""
- WHERE NOT (t2.""Description"" = @p1)
-) AS t7 ON t1.""Id"" = t7.""OwnerId""
-ORDER BY t1.""Id"", (
- SELECT COUNT(*)
- FROM ""Tags"" AS t3
- WHERE t7.""Id"" = t3.""TodoItemId""
-), t7.""LastName"", t7.""Name"", t7.Id00 DESC"));
+ command.Statement.Should().Be(_testContext.AdaptSql("""
+ SELECT t1."Id", t1."FirstName", t1."LastName", t7."Id", t7."CreatedAt", t7."Description", t7."DurationInHours", t7."LastModifiedAt", t7."Priority", t7.Id00 AS Id, t7."Name"
+ FROM "People" AS t1
+ LEFT JOIN (
+ SELECT t2."Id", t2."CreatedAt", t2."Description", t2."DurationInHours", t2."LastModifiedAt", t2."OwnerId", t2."Priority", t4."LastName", t6."Id" AS Id00, t6."Name"
+ FROM "TodoItems" AS t2
+ LEFT JOIN "People" AS t4 ON t2."AssigneeId" = t4."Id"
+ LEFT JOIN (
+ SELECT t5."Id", t5."Name", t5."TodoItemId"
+ FROM "Tags" AS t5
+ WHERE NOT (t5."Name" = @p2)
+ ) AS t6 ON t2."Id" = t6."TodoItemId"
+ WHERE NOT (t2."Description" = @p1)
+ ) AS t7 ON t1."Id" = t7."OwnerId"
+ ORDER BY t1."Id", (
+ SELECT COUNT(*)
+ FROM "Tags" AS t3
+ WHERE t7."Id" = t3."TodoItemId"
+ ), t7."LastName", t7."Name", t7.Id00 DESC
+ """));
command.Parameters.Should().HaveCount(2);
command.Parameters.Should().Contain("@p1", "X");
diff --git a/test/DapperTests/IntegrationTests/SqlTextAdapter.cs b/test/DapperTests/IntegrationTests/SqlTextAdapter.cs
index 14fe65bd22..a88646c7a7 100644
--- a/test/DapperTests/IntegrationTests/SqlTextAdapter.cs
+++ b/test/DapperTests/IntegrationTests/SqlTextAdapter.cs
@@ -7,7 +7,7 @@ internal sealed class SqlTextAdapter
{
private static readonly Dictionary SqlServerReplacements = new()
{
- [new Regex(@"""([^""]+)""", RegexOptions.Compiled)] = "[$+]",
+ [new Regex("\"([^\"]+)\"", RegexOptions.Compiled)] = "[$+]",
[new Regex($@"(VALUES \([^)]*\)){Environment.NewLine}RETURNING \[Id\]", RegexOptions.Compiled)] = $"OUTPUT INSERTED.[Id]{Environment.NewLine}$1"
};
diff --git a/test/DapperTests/UnitTests/RelationshipForeignKeyTests.cs b/test/DapperTests/UnitTests/RelationshipForeignKeyTests.cs
index aadedc8c85..fe58b3b183 100644
--- a/test/DapperTests/UnitTests/RelationshipForeignKeyTests.cs
+++ b/test/DapperTests/UnitTests/RelationshipForeignKeyTests.cs
@@ -25,7 +25,9 @@ public void Can_format_foreign_key_for_ToOne_relationship()
var foreignKey = new RelationshipForeignKey(DatabaseProvider.PostgreSql, parentRelationship, true, "ParentId", true);
// Assert
- foreignKey.ToString().Should().Be(@"TestResource.Parent => ""TestResources"".""ParentId""?");
+ foreignKey.ToString().Should().Be("""
+ TestResource.Parent => "TestResources"."ParentId"?
+ """);
}
[Fact]
@@ -39,7 +41,9 @@ public void Can_format_foreign_key_for_ToMany_relationship()
var foreignKey = new RelationshipForeignKey(DatabaseProvider.PostgreSql, childrenRelationship, false, "TestResourceId", false);
// Assert
- foreignKey.ToString().Should().Be(@"TestResource.Children => ""TestResources"".""TestResourceId""");
+ foreignKey.ToString().Should().Be("""
+ TestResource.Children => "TestResources"."TestResourceId"
+ """);
}
[UsedImplicitly]
diff --git a/test/DapperTests/UnitTests/SqlTreeNodeVisitorTests.cs b/test/DapperTests/UnitTests/SqlTreeNodeVisitorTests.cs
index 394cdecc5b..53ef375e0a 100644
--- a/test/DapperTests/UnitTests/SqlTreeNodeVisitorTests.cs
+++ b/test/DapperTests/UnitTests/SqlTreeNodeVisitorTests.cs
@@ -18,10 +18,10 @@ public void Visitor_methods_call_default_visit()
.Where(method => method.Name.StartsWith("Visit", StringComparison.Ordinal) && method.Name != "Visit").ToArray();
object?[] parameters =
- {
+ [
null,
null
- };
+ ];
// Act
foreach (MethodInfo method in visitMethods)
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/DiscoveryTests/PrivateResource.cs b/test/DiscoveryTests/PrivateResource.cs
index facbfb6c35..9ad2daef51 100644
--- a/test/DiscoveryTests/PrivateResource.cs
+++ b/test/DiscoveryTests/PrivateResource.cs
@@ -6,6 +6,4 @@ namespace DiscoveryTests;
[UsedImplicitly(ImplicitUseTargetFlags.Members)]
[Resource]
-public sealed class PrivateResource : Identifiable
-{
-}
+public sealed class PrivateResource : Identifiable;
diff --git a/test/DiscoveryTests/ServiceDiscoveryFacadeTests.cs b/test/DiscoveryTests/ServiceDiscoveryFacadeTests.cs
index 78c4213e93..e4f16dbb1f 100644
--- a/test/DiscoveryTests/ServiceDiscoveryFacadeTests.cs
+++ b/test/DiscoveryTests/ServiceDiscoveryFacadeTests.cs
@@ -15,7 +15,7 @@ namespace DiscoveryTests;
public sealed class ServiceDiscoveryFacadeTests
{
- private readonly ServiceCollection _services = new();
+ private readonly ServiceCollection _services = [];
public ServiceDiscoveryFacadeTests()
{
diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/Archiving/ArchiveTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/Archiving/ArchiveTests.cs
index 7c282051f0..6b400325e3 100644
--- a/test/JsonApiDotNetCoreTests/IntegrationTests/Archiving/ArchiveTests.cs
+++ b/test/JsonApiDotNetCoreTests/IntegrationTests/Archiving/ArchiveTests.cs
@@ -21,10 +21,7 @@ public ArchiveTests(IntegrationTestContext,
testContext.UseController();
testContext.UseController();
- testContext.ConfigureServices(services =>
- {
- services.AddResourceDefinition();
- });
+ testContext.ConfigureServices(services => services.AddResourceDefinition());
}
[Fact]
diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Controllers/CreateMusicTrackOperationsController.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Controllers/CreateMusicTrackOperationsController.cs
index 517cf4c792..5c9647f6f7 100644
--- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Controllers/CreateMusicTrackOperationsController.cs
+++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Controllers/CreateMusicTrackOperationsController.cs
@@ -22,11 +22,11 @@ public CreateMusicTrackOperationsController(IJsonApiOptions options, IResourceGr
{
}
- public override async Task PostOperationsAsync(IList operations, CancellationToken cancellationToken)
+ public override Task PostOperationsAsync(IList operations, CancellationToken cancellationToken)
{
AssertOnlyCreatingMusicTracks(operations);
- return await base.PostOperationsAsync(operations, cancellationToken);
+ return base.PostOperationsAsync(operations, cancellationToken);
}
private static void AssertOnlyCreatingMusicTracks(IEnumerable operations)
diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Creating/AtomicCreateResourceTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Creating/AtomicCreateResourceTests.cs
index 99b3b3bc5b..c77610d8dc 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;
@@ -27,10 +26,7 @@ public AtomicCreateResourceTests(IntegrationTestContext();
testContext.UseController();
- testContext.ConfigureServices(services =>
- {
- services.AddSingleton();
- });
+ testContext.ConfigureServices(services => services.AddSingleton());
var options = (JsonApiOptions)testContext.Factory.Services.GetRequiredService();
options.AllowUnknownFieldsInRequestBody = false;
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/Links/AtomicAbsoluteLinksTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Links/AtomicAbsoluteLinksTests.cs
index fdc7369a71..4b1ed95619 100644
--- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Links/AtomicAbsoluteLinksTests.cs
+++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Links/AtomicAbsoluteLinksTests.cs
@@ -25,10 +25,7 @@ public AtomicAbsoluteLinksTests(IntegrationTestContext();
testContext.UseController();
- testContext.ConfigureServices(services =>
- {
- services.AddScoped(typeof(IResourceChangeTracker<>), typeof(NeverSameResourceChangeTracker<>));
- });
+ testContext.ConfigureServices(services => services.AddScoped(typeof(IResourceChangeTracker<>), typeof(NeverSameResourceChangeTracker<>)));
}
[Fact]
diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Links/AtomicRelativeLinksWithNamespaceTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Links/AtomicRelativeLinksWithNamespaceTests.cs
index 9184161c07..6d5a276ecb 100644
--- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Links/AtomicRelativeLinksWithNamespaceTests.cs
+++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Links/AtomicRelativeLinksWithNamespaceTests.cs
@@ -26,10 +26,7 @@ public AtomicRelativeLinksWithNamespaceTests(
testContext.UseController();
testContext.UseController();
- testContext.ConfigureServices(services =>
- {
- services.AddScoped(typeof(IResourceChangeTracker<>), typeof(NeverSameResourceChangeTracker<>));
- });
+ testContext.ConfigureServices(services => services.AddScoped(typeof(IResourceChangeTracker<>), typeof(NeverSameResourceChangeTracker<>)));
}
[Fact]
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/Mixed/AtomicSerializationTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Mixed/AtomicSerializationTests.cs
index b59100dbd9..4f6a2f0a3c 100644
--- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Mixed/AtomicSerializationTests.cs
+++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Mixed/AtomicSerializationTests.cs
@@ -89,42 +89,44 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
// Assert
httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK);
- responseDocument.Should().BeJson(@"{
- ""jsonapi"": {
- ""version"": ""1.1"",
- ""ext"": [
- ""https://jsonapi.org/ext/atomic""
- ]
- },
- ""links"": {
- ""self"": ""http://localhost/operations""
- },
- ""atomic:results"": [
- {
- ""data"": null
- },
- {
- ""data"": {
- ""type"": ""textLanguages"",
- ""id"": """ + newLanguage.StringId + @""",
- ""attributes"": {
- ""isoCode"": """ + newLanguage.IsoCode + @" (changed)""
- },
- ""relationships"": {
- ""lyrics"": {
- ""links"": {
- ""self"": ""http://localhost/textLanguages/" + newLanguage.StringId + @"/relationships/lyrics"",
- ""related"": ""http://localhost/textLanguages/" + newLanguage.StringId + @"/lyrics""
+ responseDocument.Should().BeJson($$"""
+ {
+ "jsonapi": {
+ "version": "1.1",
+ "ext": [
+ "https://jsonapi.org/ext/atomic"
+ ]
+ },
+ "links": {
+ "self": "http://localhost/operations"
+ },
+ "atomic:results": [
+ {
+ "data": null
+ },
+ {
+ "data": {
+ "type": "textLanguages",
+ "id": "{{newLanguage.StringId}}",
+ "attributes": {
+ "isoCode": "{{newLanguage.IsoCode}} (changed)"
+ },
+ "relationships": {
+ "lyrics": {
+ "links": {
+ "self": "http://localhost/textLanguages/{{newLanguage.StringId}}/relationships/lyrics",
+ "related": "http://localhost/textLanguages/{{newLanguage.StringId}}/lyrics"
+ }
+ }
+ },
+ "links": {
+ "self": "http://localhost/textLanguages/{{newLanguage.StringId}}"
+ }
+ }
+ }
+ ]
}
- }
- },
- ""links"": {
- ""self"": ""http://localhost/textLanguages/" + newLanguage.StringId + @"""
- }
- }
- }
- ]
-}");
+ """);
}
[Fact]
@@ -159,27 +161,29 @@ public async Task Includes_version_with_ext_on_error_at_operations_endpoint()
string errorId = JsonApiStringConverter.ExtractErrorId(responseDocument);
- responseDocument.Should().BeJson(@"{
- ""jsonapi"": {
- ""version"": ""1.1"",
- ""ext"": [
- ""https://jsonapi.org/ext/atomic""
- ]
- },
- ""links"": {
- ""self"": ""http://localhost/operations""
- },
- ""errors"": [
- {
- ""id"": """ + errorId + @""",
- ""status"": ""404"",
- ""title"": ""The requested resource does not exist."",
- ""detail"": ""Resource of type 'musicTracks' with ID '" + musicTrackId + @"' does not exist."",
- ""source"": {
- ""pointer"": ""/atomic:operations[0]""
- }
- }
- ]
-}");
+ responseDocument.Should().BeJson($$"""
+ {
+ "jsonapi": {
+ "version": "1.1",
+ "ext": [
+ "https://jsonapi.org/ext/atomic"
+ ]
+ },
+ "links": {
+ "self": "http://localhost/operations"
+ },
+ "errors": [
+ {
+ "id": "{{errorId}}",
+ "status": "404",
+ "title": "The requested resource does not exist.",
+ "detail": "Resource of type 'musicTracks' with ID '{{musicTrackId}}' does not exist.",
+ "source": {
+ "pointer": "/atomic:operations[0]"
+ }
+ }
+ ]
+ }
+ """);
}
}
diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Mixed/AtomicTraceLoggingTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Mixed/AtomicTraceLoggingTests.cs
index d9c315513d..14e1e4fd61 100644
--- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Mixed/AtomicTraceLoggingTests.cs
+++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Mixed/AtomicTraceLoggingTests.cs
@@ -29,10 +29,7 @@ public AtomicTraceLoggingTests(IntegrationTestContext category != null && category.StartsWith("JsonApiDotNetCore.", StringComparison.Ordinal));
});
- testContext.ConfigureServices(services =>
- {
- services.AddSingleton(loggerFactory);
- });
+ testContext.ConfigureServices(services => services.AddSingleton(loggerFactory));
}
[Fact]
@@ -123,196 +120,214 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
logLines.Should().BeEquivalentTo(new[]
{
- $@"[TRACE] Received POST request at 'http://localhost/operations' with body: <<{{
- ""atomic:operations"": [
- {{
- ""op"": ""update"",
- ""data"": {{
- ""type"": ""musicTracks"",
- ""id"": ""{existingTrack.StringId}"",
- ""attributes"": {{
- ""genre"": ""{newGenre}""
- }},
- ""relationships"": {{
- ""lyric"": {{
- ""data"": {{
- ""type"": ""lyrics"",
- ""id"": ""{existingLyric.StringId}""
- }}
- }},
- ""ownedBy"": {{
- ""data"": {{
- ""type"": ""recordCompanies"",
- ""id"": ""{existingCompany.StringId}""
- }}
- }},
- ""performers"": {{
- ""data"": [
- {{
- ""type"": ""performers"",
- ""id"": ""{existingPerformer.StringId}""
- }}
- ]
- }}
- }}
- }}
- }}
- ]
-}}>>",
- $@"[TRACE] Entering PostOperationsAsync(operations: [
- {{
- ""Resource"": {{
- ""Id"": ""{existingTrack.StringId}"",
- ""Genre"": ""{newGenre}"",
- ""ReleasedAt"": ""0001-01-01T00:00:00+00:00"",
- ""Lyric"": {{
- ""CreatedAt"": ""0001-01-01T00:00:00+00:00"",
- ""Id"": {existingLyric.Id},
- ""StringId"": ""{existingLyric.StringId}""
- }},
- ""OwnedBy"": {{
- ""Tracks"": [],
- ""Id"": {existingCompany.Id},
- ""StringId"": ""{existingCompany.StringId}""
- }},
- ""Performers"": [
- {{
- ""BornAt"": ""0001-01-01T00:00:00+00:00"",
- ""Id"": {existingPerformer.Id},
- ""StringId"": ""{existingPerformer.StringId}""
- }}
- ],
- ""OccursIn"": [],
- ""StringId"": ""{existingTrack.StringId}""
- }},
- ""TargetedFields"": {{
- ""Attributes"": [
- ""genre""
- ],
- ""Relationships"": [
- ""lyric"",
- ""ownedBy"",
- ""performers""
- ]
- }},
- ""Request"": {{
- ""Kind"": ""AtomicOperations"",
- ""PrimaryId"": ""{existingTrack.StringId}"",
- ""PrimaryResourceType"": ""musicTracks"",
- ""IsCollection"": false,
- ""IsReadOnly"": false,
- ""WriteOperation"": ""UpdateResource""
- }}
- }}
-])",
- $@"[TRACE] Entering UpdateAsync(id: {existingTrack.StringId}, resource: {{
- ""Id"": ""{existingTrack.StringId}"",
- ""Genre"": ""{newGenre}"",
- ""ReleasedAt"": ""0001-01-01T00:00:00+00:00"",
- ""Lyric"": {{
- ""CreatedAt"": ""0001-01-01T00:00:00+00:00"",
- ""Id"": {existingLyric.Id},
- ""StringId"": ""{existingLyric.StringId}""
- }},
- ""OwnedBy"": {{
- ""Tracks"": [],
- ""Id"": {existingCompany.Id},
- ""StringId"": ""{existingCompany.StringId}""
- }},
- ""Performers"": [
- {{
- ""BornAt"": ""0001-01-01T00:00:00+00:00"",
- ""Id"": {existingPerformer.Id},
- ""StringId"": ""{existingPerformer.StringId}""
- }}
- ],
- ""OccursIn"": [],
- ""StringId"": ""{existingTrack.StringId}""
-}})",
- $@"[TRACE] Entering GetForUpdateAsync(queryLayer: QueryLayer
-{{
- Include: lyric,ownedBy,performers
- Filter: equals(id,'{existingTrack.StringId}')
-}}
-)",
- $@"[TRACE] Entering GetAsync(queryLayer: QueryLayer
-{{
- Include: lyric,ownedBy,performers
- Filter: equals(id,'{existingTrack.StringId}')
-}}
-)",
- $@"[TRACE] Entering ApplyQueryLayer(queryLayer: QueryLayer
-{{
- Include: lyric,ownedBy,performers
- Filter: equals(id,'{existingTrack.StringId}')
-}}
-)",
- $@"[TRACE] Entering UpdateAsync(resourceFromRequest: {{
- ""Id"": ""{existingTrack.StringId}"",
- ""Genre"": ""{newGenre}"",
- ""ReleasedAt"": ""0001-01-01T00:00:00+00:00"",
- ""Lyric"": {{
- ""CreatedAt"": ""0001-01-01T00:00:00+00:00"",
- ""Id"": {existingLyric.Id},
- ""StringId"": ""{existingLyric.StringId}""
- }},
- ""OwnedBy"": {{
- ""Tracks"": [],
- ""Id"": {existingCompany.Id},
- ""StringId"": ""{existingCompany.StringId}""
- }},
- ""Performers"": [
- {{
- ""BornAt"": ""0001-01-01T00:00:00+00:00"",
- ""Id"": {existingPerformer.Id},
- ""StringId"": ""{existingPerformer.StringId}""
- }}
- ],
- ""OccursIn"": [],
- ""StringId"": ""{existingTrack.StringId}""
-}}, resourceFromDatabase: {{
- ""Id"": ""{existingTrack.StringId}"",
- ""Title"": ""{existingTrack.Title}"",
- ""LengthInSeconds"": {JsonSerializer.Serialize(existingTrack.LengthInSeconds)},
- ""Genre"": ""{existingTrack.Genre}"",
- ""ReleasedAt"": {JsonSerializer.Serialize(existingTrack.ReleasedAt)},
- ""Lyric"": {{
- ""Format"": ""{existingTrack.Lyric.Format}"",
- ""Text"": {JsonSerializer.Serialize(existingTrack.Lyric.Text)},
- ""CreatedAt"": ""0001-01-01T00:00:00+00:00"",
- ""Id"": {existingTrack.Lyric.Id},
- ""StringId"": ""{existingTrack.Lyric.StringId}""
- }},
- ""OwnedBy"": {{
- ""Name"": ""{existingTrack.OwnedBy.Name}"",
- ""CountryOfResidence"": ""{existingTrack.OwnedBy.CountryOfResidence}"",
- ""Tracks"": [
- null
- ],
- ""Id"": {existingTrack.OwnedBy.Id},
- ""StringId"": ""{existingTrack.OwnedBy.StringId}""
- }},
- ""Performers"": [
- {{
- ""ArtistName"": ""{existingTrack.Performers[0].ArtistName}"",
- ""BornAt"": {JsonSerializer.Serialize(existingTrack.Performers[0].BornAt)},
- ""Id"": {existingTrack.Performers[0].Id},
- ""StringId"": ""{existingTrack.Performers[0].StringId}""
- }}
- ],
- ""OccursIn"": [],
- ""StringId"": ""{existingTrack.StringId}""
-}})",
- $@"[TRACE] Entering GetAsync(queryLayer: QueryLayer
-{{
- Filter: equals(id,'{existingTrack.StringId}')
-}}
-)",
- $@"[TRACE] Entering ApplyQueryLayer(queryLayer: QueryLayer
-{{
- Filter: equals(id,'{existingTrack.StringId}')
-}}
-)"
+ $$"""
+ [TRACE] Received POST request at 'http://localhost/operations' with body: <<{
+ "atomic:operations": [
+ {
+ "op": "update",
+ "data": {
+ "type": "musicTracks",
+ "id": "{{existingTrack.StringId}}",
+ "attributes": {
+ "genre": "{{newGenre}}"
+ },
+ "relationships": {
+ "lyric": {
+ "data": {
+ "type": "lyrics",
+ "id": "{{existingLyric.StringId}}"
+ }
+ },
+ "ownedBy": {
+ "data": {
+ "type": "recordCompanies",
+ "id": "{{existingCompany.StringId}}"
+ }
+ },
+ "performers": {
+ "data": [
+ {
+ "type": "performers",
+ "id": "{{existingPerformer.StringId}}"
+ }
+ ]
+ }
+ }
+ }
+ }
+ ]
+ }>>
+ """,
+ $$"""
+ [TRACE] Entering PostOperationsAsync(operations: [
+ {
+ "Resource": {
+ "Id": "{{existingTrack.StringId}}",
+ "Genre": "{{newGenre}}",
+ "ReleasedAt": "0001-01-01T00:00:00+00:00",
+ "Lyric": {
+ "CreatedAt": "0001-01-01T00:00:00+00:00",
+ "Id": {{existingLyric.Id}},
+ "StringId": "{{existingLyric.StringId}}"
+ },
+ "OwnedBy": {
+ "Tracks": [],
+ "Id": {{existingCompany.Id}},
+ "StringId": "{{existingCompany.StringId}}"
+ },
+ "Performers": [
+ {
+ "BornAt": "0001-01-01T00:00:00+00:00",
+ "Id": {{existingPerformer.Id}},
+ "StringId": "{{existingPerformer.StringId}}"
+ }
+ ],
+ "OccursIn": [],
+ "StringId": "{{existingTrack.StringId}}"
+ },
+ "TargetedFields": {
+ "Attributes": [
+ "genre"
+ ],
+ "Relationships": [
+ "lyric",
+ "ownedBy",
+ "performers"
+ ]
+ },
+ "Request": {
+ "Kind": "AtomicOperations",
+ "PrimaryId": "{{existingTrack.StringId}}",
+ "PrimaryResourceType": "musicTracks",
+ "IsCollection": false,
+ "IsReadOnly": false,
+ "WriteOperation": "UpdateResource"
+ }
+ }
+ ])
+ """,
+ $$"""
+ [TRACE] Entering UpdateAsync(id: {{existingTrack.StringId}}, resource: {
+ "Id": "{{existingTrack.StringId}}",
+ "Genre": "{{newGenre}}",
+ "ReleasedAt": "0001-01-01T00:00:00+00:00",
+ "Lyric": {
+ "CreatedAt": "0001-01-01T00:00:00+00:00",
+ "Id": {{existingLyric.Id}},
+ "StringId": "{{existingLyric.StringId}}"
+ },
+ "OwnedBy": {
+ "Tracks": [],
+ "Id": {{existingCompany.Id}},
+ "StringId": "{{existingCompany.StringId}}"
+ },
+ "Performers": [
+ {
+ "BornAt": "0001-01-01T00:00:00+00:00",
+ "Id": {{existingPerformer.Id}},
+ "StringId": "{{existingPerformer.StringId}}"
+ }
+ ],
+ "OccursIn": [],
+ "StringId": "{{existingTrack.StringId}}"
+ })
+ """,
+ $$"""
+ [TRACE] Entering GetForUpdateAsync(queryLayer: QueryLayer
+ {
+ Include: lyric,ownedBy,performers
+ Filter: equals(id,'{{existingTrack.StringId}}')
+ }
+ )
+ """,
+ $$"""
+ [TRACE] Entering GetAsync(queryLayer: QueryLayer
+ {
+ Include: lyric,ownedBy,performers
+ Filter: equals(id,'{{existingTrack.StringId}}')
+ }
+ )
+ """,
+ $$"""
+ [TRACE] Entering ApplyQueryLayer(queryLayer: QueryLayer
+ {
+ Include: lyric,ownedBy,performers
+ Filter: equals(id,'{{existingTrack.StringId}}')
+ }
+ )
+ """,
+ $$"""
+ [TRACE] Entering UpdateAsync(resourceFromRequest: {
+ "Id": "{{existingTrack.StringId}}",
+ "Genre": "{{newGenre}}",
+ "ReleasedAt": "0001-01-01T00:00:00+00:00",
+ "Lyric": {
+ "CreatedAt": "0001-01-01T00:00:00+00:00",
+ "Id": {{existingLyric.Id}},
+ "StringId": "{{existingLyric.StringId}}"
+ },
+ "OwnedBy": {
+ "Tracks": [],
+ "Id": {{existingCompany.Id}},
+ "StringId": "{{existingCompany.StringId}}"
+ },
+ "Performers": [
+ {
+ "BornAt": "0001-01-01T00:00:00+00:00",
+ "Id": {{existingPerformer.Id}},
+ "StringId": "{{existingPerformer.StringId}}"
+ }
+ ],
+ "OccursIn": [],
+ "StringId": "{{existingTrack.StringId}}"
+ }, resourceFromDatabase: {
+ "Id": "{{existingTrack.StringId}}",
+ "Title": "{{existingTrack.Title}}",
+ "LengthInSeconds": {{JsonSerializer.Serialize(existingTrack.LengthInSeconds)}},
+ "Genre": "{{existingTrack.Genre}}",
+ "ReleasedAt": {{JsonSerializer.Serialize(existingTrack.ReleasedAt)}},
+ "Lyric": {
+ "Format": "{{existingTrack.Lyric.Format}}",
+ "Text": {{JsonSerializer.Serialize(existingTrack.Lyric.Text)}},
+ "CreatedAt": "0001-01-01T00:00:00+00:00",
+ "Id": {{existingTrack.Lyric.Id}},
+ "StringId": "{{existingTrack.Lyric.StringId}}"
+ },
+ "OwnedBy": {
+ "Name": "{{existingTrack.OwnedBy.Name}}",
+ "CountryOfResidence": "{{existingTrack.OwnedBy.CountryOfResidence}}",
+ "Tracks": [
+ null
+ ],
+ "Id": {{existingTrack.OwnedBy.Id}},
+ "StringId": "{{existingTrack.OwnedBy.StringId}}"
+ },
+ "Performers": [
+ {
+ "ArtistName": "{{existingTrack.Performers[0].ArtistName}}",
+ "BornAt": {{JsonSerializer.Serialize(existingTrack.Performers[0].BornAt)}},
+ "Id": {{existingTrack.Performers[0].Id}},
+ "StringId": "{{existingTrack.Performers[0].StringId}}"
+ }
+ ],
+ "OccursIn": [],
+ "StringId": "{{existingTrack.StringId}}"
+ })
+ """,
+ $$"""
+ [TRACE] Entering GetAsync(queryLayer: QueryLayer
+ {
+ Filter: equals(id,'{{existingTrack.StringId}}')
+ }
+ )
+ """,
+ $$"""
+ [TRACE] Entering ApplyQueryLayer(queryLayer: QueryLayer
+ {
+ Filter: equals(id,'{{existingTrack.StringId}}')
+ }
+ )
+ """
}, options => options.Using(IgnoreLineEndingsComparer.Instance).WithStrictOrdering());
}
}
diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/ModelStateValidation/AtomicModelStateValidationTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/ModelStateValidation/AtomicModelStateValidationTests.cs
index 4a8b7d9e52..1d095377bd 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;
@@ -18,10 +17,7 @@ public AtomicModelStateValidationTests(IntegrationTestContext
- {
- services.AddSingleton();
- });
+ _testContext.ConfigureServices(services => services.AddSingleton());
testContext.UseController();
}
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/ResourceDefinitions/Serialization/AtomicSerializationResourceDefinitionTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/ResourceDefinitions/Serialization/AtomicSerializationResourceDefinitionTests.cs
index 4e2fa4f937..b8095b38f9 100644
--- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/ResourceDefinitions/Serialization/AtomicSerializationResourceDefinitionTests.cs
+++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/ResourceDefinitions/Serialization/AtomicSerializationResourceDefinitionTests.cs
@@ -42,10 +42,7 @@ public async Task Transforms_on_create_resource_with_side_effects()
List newCompanies = _fakers.RecordCompany.Generate(2);
- await _testContext.RunOnDatabaseAsync(async dbContext =>
- {
- await dbContext.ClearTableAsync();
- });
+ await _testContext.RunOnDatabaseAsync(dbContext => dbContext.ClearTableAsync());
var requestBody = new
{
diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Transactions/AtomicRollbackTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Transactions/AtomicRollbackTests.cs
index 82646686d4..5fe125928c 100644
--- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Transactions/AtomicRollbackTests.cs
+++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Transactions/AtomicRollbackTests.cs
@@ -27,10 +27,7 @@ public async Task Can_rollback_on_error()
DateTimeOffset newBornAt = _fakers.Performer.Generate().BornAt;
string newTitle = _fakers.MusicTrack.Generate().Title;
- await _testContext.RunOnDatabaseAsync(async dbContext =>
- {
- await dbContext.ClearTablesAsync();
- });
+ await _testContext.RunOnDatabaseAsync(dbContext => dbContext.ClearTablesAsync());
string unknownPerformerId = Unknown.StringId.For();
@@ -113,10 +110,7 @@ public async Task Can_restore_to_previous_savepoint_on_error()
// Arrange
string newTrackTitle = _fakers.MusicTrack.Generate().Title;
- await _testContext.RunOnDatabaseAsync(async dbContext =>
- {
- await dbContext.ClearTablesAsync();
- });
+ await _testContext.RunOnDatabaseAsync(dbContext => dbContext.ClearTablesAsync());
const string trackLid = "track-1";
diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Relationships/AtomicAddToToManyRelationshipTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Relationships/AtomicAddToToManyRelationshipTests.cs
index 909467ad18..293b4b495c 100644
--- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Relationships/AtomicAddToToManyRelationshipTests.cs
+++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Relationships/AtomicAddToToManyRelationshipTests.cs
@@ -910,10 +910,10 @@ public async Task Cannot_add_for_unknown_IDs_in_data()
RecordCompany existingCompany = _fakers.RecordCompany.Generate();
string[] trackIds =
- {
+ [
Unknown.StringId.For(),
Unknown.StringId.AltFor()
- };
+ ];
await _testContext.RunOnDatabaseAsync(async dbContext =>
{
diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Relationships/AtomicRemoveFromToManyRelationshipTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Relationships/AtomicRemoveFromToManyRelationshipTests.cs
index 71b4a1bf09..7e9654ab30 100644
--- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Relationships/AtomicRemoveFromToManyRelationshipTests.cs
+++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Relationships/AtomicRemoveFromToManyRelationshipTests.cs
@@ -870,10 +870,10 @@ public async Task Cannot_remove_for_unknown_IDs_in_data()
RecordCompany existingCompany = _fakers.RecordCompany.Generate();
string[] trackIds =
- {
+ [
Unknown.StringId.For(),
Unknown.StringId.AltFor()
- };
+ ];
await _testContext.RunOnDatabaseAsync(async dbContext =>
{
diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Relationships/AtomicReplaceToManyRelationshipTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Relationships/AtomicReplaceToManyRelationshipTests.cs
index f36144ce70..bcedf104bf 100644
--- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Relationships/AtomicReplaceToManyRelationshipTests.cs
+++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Relationships/AtomicReplaceToManyRelationshipTests.cs
@@ -963,10 +963,10 @@ public async Task Cannot_replace_for_unknown_IDs_in_data()
RecordCompany existingCompany = _fakers.RecordCompany.Generate();
string[] trackIds =
- {
+ [
Unknown.StringId.For(),
Unknown.StringId.AltFor()
- };
+ ];
await _testContext.RunOnDatabaseAsync(async dbContext =>
{
diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Resources/AtomicReplaceToManyRelationshipTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Resources/AtomicReplaceToManyRelationshipTests.cs
index 0d8c5e1d80..10da541794 100644
--- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Resources/AtomicReplaceToManyRelationshipTests.cs
+++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Updating/Resources/AtomicReplaceToManyRelationshipTests.cs
@@ -668,10 +668,10 @@ public async Task Cannot_replace_for_unknown_IDs_in_relationship_data()
RecordCompany existingCompany = _fakers.RecordCompany.Generate();
string[] trackIds =
- {
+ [
Unknown.StringId.For(),
Unknown.StringId.AltFor()
- };
+ ];
await _testContext.RunOnDatabaseAsync(async dbContext =>
{
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/Authorization/Scopes/AuthScopeSet.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/Authorization/Scopes/AuthScopeSet.cs
index 3a99d3c015..547c008afa 100644
--- a/test/JsonApiDotNetCoreTests/IntegrationTests/Authorization/Scopes/AuthScopeSet.cs
+++ b/test/JsonApiDotNetCoreTests/IntegrationTests/Authorization/Scopes/AuthScopeSet.cs
@@ -14,7 +14,7 @@ internal sealed class AuthScopeSet
public const string ScopesHeaderName = "X-Auth-Scopes";
- private readonly Dictionary _scopes = new();
+ private readonly Dictionary _scopes = [];
public static AuthScopeSet GetRequestedScopes(IHeaderDictionary requestHeaders)
{
diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/Blobs/BlobTests.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/Blobs/BlobTests.cs
index 727245f06e..fca26c66c3 100644
--- a/test/JsonApiDotNetCoreTests/IntegrationTests/Blobs/BlobTests.cs
+++ b/test/JsonApiDotNetCoreTests/IntegrationTests/Blobs/BlobTests.cs
@@ -19,10 +19,7 @@ public BlobTests(IntegrationTestContext