Skip to content

Commit

Permalink
Merge pull request #1694 from json-api-dotnet/merge-master-into-openapi
Browse files Browse the repository at this point in the history
Merge master into openapi
  • Loading branch information
bkoelman authored Mar 2, 2025
2 parents fcd3aa1 + 61c6cd5 commit 749e588
Show file tree
Hide file tree
Showing 218 changed files with 4,752 additions and 4,741 deletions.
2 changes: 1 addition & 1 deletion .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"isRoot": true,
"tools": {
"jetbrains.resharper.globaltools": {
"version": "2024.3.5",
"version": "2024.3.6",
"commands": [
"jb"
],
Expand Down
8 changes: 8 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,12 @@ csharp_style_expression_bodied_properties = true:silent
# IDE0025: Use expression body for properties
dotnet_diagnostic.IDE0025.severity = silent

# Member preferences (these analyzers are unreliable)
# IDE0051: Remove unused private member
dotnet_diagnostic.IDE0051.severity = silent
# IDE0052: Remove unread private member
dotnet_diagnostic.IDE0052.severity = silent

# Code-block preferences
csharp_prefer_braces = true:silent
# IDE0011: Add braces
Expand Down Expand Up @@ -142,11 +148,13 @@ dotnet_diagnostic.IDE0047.severity = silent
# IDE0048: Add parentheses for clarity
dotnet_diagnostic.IDE0048.severity = silent

# Switch preferences
# IDE0010: Add missing cases to switch statement
dotnet_diagnostic.IDE0010.severity = silent
# IDE0072: Add missing cases to switch expression
dotnet_diagnostic.IDE0072.severity = silent

# Null check preferences
# IDE0029: Null check can be simplified
dotnet_diagnostic.IDE0029.severity = silent
# IDE0030: Null check can be simplified
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ concurrency:
cancel-in-progress: true

env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
DOTNET_NOLOGO: true
DOTNET_CLI_TELEMETRY_OPTOUT: true

jobs:
Expand All @@ -47,8 +47,8 @@ jobs:
with:
# Block buggy release from February 11, 2025
dotnet-version: |
8.0.309
9.0.103
8.0.*
9.0.*
- name: Show installed versions
shell: pwsh
run: |
Expand Down Expand Up @@ -166,8 +166,8 @@ jobs:
with:
# Block buggy release from February 11, 2025
dotnet-version: |
8.0.309
9.0.103
8.0.*
9.0.*
- name: Git checkout
uses: actions/checkout@v4
- name: Restore tools
Expand Down Expand Up @@ -222,8 +222,8 @@ jobs:
with:
# Block buggy release from February 11, 2025
dotnet-version: |
8.0.309
9.0.103
8.0.*
9.0.*
- name: Git checkout
uses: actions/checkout@v4
with:
Expand Down
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
Taking the suggestion TODAY produces List<string>, but the spec doesn't require that, so the compiler may change it over time.
As a result, callers that cast back to List<string> will face a breaking change.
-->
<UseCollectionExpressionRules>IDE0028;IDE0300;IDE0301;IDE0302;IDE0303;IDE0304;IDE0305</UseCollectionExpressionRules>
<UseCollectionExpressionRules>IDE0028;IDE0300;IDE0301;IDE0302;IDE0303;IDE0304;IDE0305;IDE0306</UseCollectionExpressionRules>
<NoWarn>$(NoWarn);$(UseCollectionExpressionRules)</NoWarn>

<!-- Suppress warning that targeting .NET Standard 1.0 is not recommended, because it requires a breaking change. -->
Expand Down
2 changes: 1 addition & 1 deletion package-versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<CodeAnalysisVersion>4.12.*</CodeAnalysisVersion>
<CoverletVersion>6.0.*</CoverletVersion>
<DapperVersion>2.1.*</DapperVersion>
<FluentAssertionsVersion>7.0.*</FluentAssertionsVersion>
<FluentAssertionsVersion>7.2.*</FluentAssertionsVersion>
<GitHubActionsTestLoggerVersion>2.4.*</GitHubActionsTestLoggerVersion>
<InheritDocVersion>2.0.*</InheritDocVersion>
<KiotaVersion>1.*</KiotaVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,20 +168,20 @@ public async Task Can_use_multiple_operations()
// Assert
httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK);

responseDocument.Results.ShouldHaveCount(7);
responseDocument.Results.Should().HaveCount(7);

responseDocument.Results[0].Data.SingleValue.ShouldNotBeNull().With(resource => resource.Type.Should().Be("people"));
responseDocument.Results[1].Data.SingleValue.ShouldNotBeNull().With(resource => resource.Type.Should().Be("people"));
responseDocument.Results[2].Data.SingleValue.ShouldNotBeNull().With(resource => resource.Type.Should().Be("tags"));
responseDocument.Results[3].Data.SingleValue.ShouldNotBeNull().With(resource => resource.Type.Should().Be("todoItems"));
responseDocument.Results[0].Data.SingleValue.RefShould().NotBeNull().And.Subject.Type.Should().Be("people");
responseDocument.Results[1].Data.SingleValue.RefShould().NotBeNull().And.Subject.Type.Should().Be("people");
responseDocument.Results[2].Data.SingleValue.RefShould().NotBeNull().And.Subject.Type.Should().Be("tags");
responseDocument.Results[3].Data.SingleValue.RefShould().NotBeNull().And.Subject.Type.Should().Be("todoItems");
responseDocument.Results[4].Data.Value.Should().BeNull();
responseDocument.Results[5].Data.SingleValue.ShouldNotBeNull().With(resource => resource.Type.Should().Be("todoItems"));
responseDocument.Results[5].Data.SingleValue.RefShould().NotBeNull().And.Subject.Type.Should().Be("todoItems");
responseDocument.Results[6].Data.Value.Should().BeNull();

long newOwnerId = long.Parse(responseDocument.Results[0].Data.SingleValue!.Id.ShouldNotBeNull());
long newAssigneeId = long.Parse(responseDocument.Results[1].Data.SingleValue!.Id.ShouldNotBeNull());
long newTagId = long.Parse(responseDocument.Results[2].Data.SingleValue!.Id.ShouldNotBeNull());
long newTodoItemId = long.Parse(responseDocument.Results[3].Data.SingleValue!.Id.ShouldNotBeNull());
long newOwnerId = long.Parse(responseDocument.Results[0].Data.SingleValue!.Id.Should().NotBeNull().And.Subject);
long newAssigneeId = long.Parse(responseDocument.Results[1].Data.SingleValue!.Id.Should().NotBeNull().And.Subject);
long newTagId = long.Parse(responseDocument.Results[2].Data.SingleValue!.Id.Should().NotBeNull().And.Subject);
long newTodoItemId = long.Parse(responseDocument.Results[3].Data.SingleValue!.Id.Should().NotBeNull().And.Subject);

await _testContext.RunOnDatabaseAsync(async dbContext =>
{
Expand All @@ -203,14 +203,14 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
todoItemInDatabase.CreatedAt.Should().Be(DapperTestContext.FrozenTime);
todoItemInDatabase.LastModifiedAt.Should().Be(DapperTestContext.FrozenTime);

todoItemInDatabase.Owner.ShouldNotBeNull();
todoItemInDatabase.Owner.Should().NotBeNull();
todoItemInDatabase.Owner.Id.Should().Be(newOwnerId);
todoItemInDatabase.Assignee.Should().BeNull();
todoItemInDatabase.Tags.ShouldHaveCount(1);
todoItemInDatabase.Tags.Should().HaveCount(1);
todoItemInDatabase.Tags.ElementAt(0).Id.Should().Be(newTagId);
});

store.SqlCommands.ShouldHaveCount(15);
store.SqlCommands.Should().HaveCount(15);

store.SqlCommands[0].With(command =>
{
Expand All @@ -220,7 +220,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
RETURNING "Id"
"""));

command.Parameters.ShouldHaveCount(3);
command.Parameters.Should().HaveCount(3);
command.Parameters.Should().Contain("@p1", newOwner.FirstName);
command.Parameters.Should().Contain("@p2", newOwner.LastName);
command.Parameters.Should().Contain("@p3", null);
Expand All @@ -234,7 +234,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
WHERE t1."Id" = @p1
"""));

command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().HaveCount(1);
command.Parameters.Should().Contain("@p1", newOwnerId);
});

Expand All @@ -246,7 +246,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
RETURNING "Id"
"""));

command.Parameters.ShouldHaveCount(3);
command.Parameters.Should().HaveCount(3);
command.Parameters.Should().Contain("@p1", newAssignee.FirstName);
command.Parameters.Should().Contain("@p2", newAssignee.LastName);
command.Parameters.Should().Contain("@p3", null);
Expand All @@ -260,7 +260,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
WHERE t1."Id" = @p1
"""));

command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().HaveCount(1);
command.Parameters.Should().Contain("@p1", newAssigneeId);
});

Expand All @@ -272,7 +272,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
RETURNING "Id"
"""));

command.Parameters.ShouldHaveCount(2);
command.Parameters.Should().HaveCount(2);
command.Parameters.Should().Contain("@p1", newTag.Name);
command.Parameters.Should().Contain("@p2", null);
});
Expand All @@ -285,7 +285,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
WHERE t1."Id" = @p1
"""));

command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().HaveCount(1);
command.Parameters.Should().Contain("@p1", newTagId);
});

Expand All @@ -297,7 +297,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
RETURNING "Id"
"""));

command.Parameters.ShouldHaveCount(7);
command.Parameters.Should().HaveCount(7);
command.Parameters.Should().Contain("@p1", newTodoItem.Description);
command.Parameters.Should().Contain("@p2", newTodoItem.Priority);
command.Parameters.Should().Contain("@p3", newTodoItem.DurationInHours);
Expand All @@ -315,7 +315,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
WHERE t1."Id" = @p1
"""));

command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().HaveCount(1);
command.Parameters.Should().Contain("@p1", newTodoItemId);
});

Expand All @@ -328,7 +328,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
WHERE t1."Id" = @p1
"""));

command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().HaveCount(1);
command.Parameters.Should().Contain("@p1", newTodoItemId);
});

Expand All @@ -340,7 +340,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
WHERE "Id" = @p2
"""));

command.Parameters.ShouldHaveCount(2);
command.Parameters.Should().HaveCount(2);
command.Parameters.Should().Contain("@p1", newAssigneeId);
command.Parameters.Should().Contain("@p2", newTodoItemId);
});
Expand All @@ -354,7 +354,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
WHERE t1."Id" = @p1
"""));

command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().HaveCount(1);
command.Parameters.Should().Contain("@p1", newTodoItemId);
});

Expand All @@ -366,7 +366,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
WHERE "Id" = @p2
"""));

command.Parameters.ShouldHaveCount(2);
command.Parameters.Should().HaveCount(2);
command.Parameters.Should().Contain("@p1", DapperTestContext.FrozenTime);
command.Parameters.Should().Contain("@p2", newTodoItemId);
});
Expand All @@ -379,7 +379,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
WHERE "Id" = @p2
"""));

command.Parameters.ShouldHaveCount(2);
command.Parameters.Should().HaveCount(2);
command.Parameters.Should().Contain("@p1", newTodoItemId);
command.Parameters.Should().Contain("@p2", newTagId);
});
Expand All @@ -392,7 +392,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
WHERE t1."Id" = @p1
"""));

command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().HaveCount(1);
command.Parameters.Should().Contain("@p1", newTodoItemId);
});

Expand All @@ -403,7 +403,7 @@ DELETE FROM "People"
WHERE "Id" = @p1
"""));

command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().HaveCount(1);
command.Parameters.Should().Contain("@p1", newAssigneeId);
});
}
Expand Down Expand Up @@ -469,13 +469,13 @@ public async Task Can_rollback_on_error()
// Assert
httpResponse.ShouldHaveStatusCode(HttpStatusCode.NotFound);

responseDocument.Errors.ShouldHaveCount(1);
responseDocument.Errors.Should().HaveCount(1);

ErrorObject error = responseDocument.Errors[0];
error.StatusCode.Should().Be(HttpStatusCode.NotFound);
error.Title.Should().Be("A related resource does not exist.");
error.Detail.Should().Be($"Related resource of type 'todoItems' with ID '{unknownTodoItemId}' in relationship 'assignedTodoItems' does not exist.");
error.Source.ShouldNotBeNull();
error.Source.Should().NotBeNull();
error.Source.Pointer.Should().Be("/atomic:operations[1]");

await _testContext.RunOnDatabaseAsync(async dbContext =>
Expand All @@ -484,7 +484,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
peopleInDatabase.Should().BeEmpty();
});

store.SqlCommands.ShouldHaveCount(5);
store.SqlCommands.Should().HaveCount(5);

store.SqlCommands[0].With(command =>
{
Expand All @@ -494,7 +494,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
RETURNING "Id"
"""));

command.Parameters.ShouldHaveCount(3);
command.Parameters.Should().HaveCount(3);
command.Parameters.Should().Contain("@p1", null);
command.Parameters.Should().Contain("@p2", newPerson.LastName);
command.Parameters.Should().Contain("@p3", null);
Expand All @@ -508,8 +508,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
WHERE t1."Id" = @p1
"""));

command.Parameters.ShouldHaveCount(1);
command.Parameters.ShouldContainKey("@p1").With(value => value.ShouldNotBeNull());
command.Parameters.Should().HaveCount(1);
command.Parameters.Should().ContainKey("@p1").WhoseValue.Should().NotBeNull();
});

store.SqlCommands[2].With(command =>
Expand All @@ -521,8 +521,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
WHERE t1."Id" = @p1
"""));

command.Parameters.ShouldHaveCount(1);
command.Parameters.ShouldContainKey("@p1").With(value => value.ShouldNotBeNull());
command.Parameters.Should().HaveCount(1);
command.Parameters.Should().ContainKey("@p1").WhoseValue.Should().NotBeNull();
});

store.SqlCommands[3].With(command =>
Expand All @@ -533,8 +533,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
WHERE "Id" = @p2
"""));

command.Parameters.ShouldHaveCount(2);
command.Parameters.ShouldContainKey("@p1").With(value => value.ShouldNotBeNull());
command.Parameters.Should().HaveCount(2);
command.Parameters.Should().ContainKey("@p1").WhoseValue.Should().NotBeNull();
command.Parameters.Should().Contain("@p2", unknownTodoItemId);
});

Expand All @@ -546,7 +546,7 @@ SELECT t1."Id"
WHERE t1."Id" = @p1
"""));

command.Parameters.ShouldHaveCount(1);
command.Parameters.Should().HaveCount(1);
command.Parameters.Should().Contain("@p1", unknownTodoItemId);
});
}
Expand Down
Loading

0 comments on commit 749e588

Please sign in to comment.