fix(pr-review): resolve inline review comments regarding debounce race and result pattern

This commit is contained in:
2026-06-15 19:14:13 +02:00
parent b74ba4ba54
commit 8de02c32c5
6 changed files with 51 additions and 45 deletions
@@ -169,7 +169,7 @@ public class PublishBookVersionTests : IDisposable
}
[Fact]
public async Task Handle_WithMismatchedTenantId_ThrowsBookNotFoundException()
public async Task Handle_WithMismatchedTenantId_ReturnsFailure()
{
// Arrange
var bookId = Guid.NewGuid();
@@ -210,13 +210,16 @@ public class PublishBookVersionTests : IDisposable
var handler = new PublishBookVersionCommandHandler(_dbContextFactoryMock.Object);
// Act & Assert
var action = () => handler.Handle(command, CancellationToken.None);
await action.Should().ThrowAsync<BookNotFoundException>();
// Act
var result = await handler.Handle(command, CancellationToken.None);
// Assert
result.IsSuccess.Should().BeFalse();
result.Errors.Should().Contain(e => e.Message.Contains("was not found"));
}
[Fact]
public async Task Handle_WithMismatchedUserId_ThrowsBookNotFoundException()
public async Task Handle_WithMismatchedUserId_ReturnsFailure()
{
// Arrange
var bookId = Guid.NewGuid();
@@ -257,13 +260,16 @@ public class PublishBookVersionTests : IDisposable
var handler = new PublishBookVersionCommandHandler(_dbContextFactoryMock.Object);
// Act & Assert
var action = () => handler.Handle(command, CancellationToken.None);
await action.Should().ThrowAsync<BookNotFoundException>();
// Act
var result = await handler.Handle(command, CancellationToken.None);
// Assert
result.IsSuccess.Should().BeFalse();
result.Errors.Should().Contain(e => e.Message.Contains("was not found"));
}
[Fact]
public async Task Handle_WithNonExistentBook_ThrowsBookNotFoundException()
public async Task Handle_WithNonExistentBook_ReturnsFailure()
{
// Arrange
var command = new PublishBookVersionCommand(
@@ -275,9 +281,12 @@ public class PublishBookVersionTests : IDisposable
var handler = new PublishBookVersionCommandHandler(_dbContextFactoryMock.Object);
// Act & Assert
var action = () => handler.Handle(command, CancellationToken.None);
await action.Should().ThrowAsync<BookNotFoundException>();
// Act
var result = await handler.Handle(command, CancellationToken.None);
// Assert
result.IsSuccess.Should().BeFalse();
result.Errors.Should().Contain(e => e.Message.Contains("was not found"));
}
public void Dispose()