Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
2 changes: 1 addition & 1 deletion package-versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,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>
<SystemTextJsonVersion>9.0.*</SystemTextJsonVersion>
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
Loading