public async Task AcknowledgeThrowsIfHandledIsTrue() { var message = new FakeReceiverMessage("Hello, world!"); await message.AcknowledgeAsync(); Func <Task> act = () => message.AcknowledgeAsync(); act.Should().Throw <InvalidOperationException>() .WithMessage($"Cannot {nameof(message.AcknowledgeAsync)} message: the message has already been handled by {nameof(message.AcknowledgeAsync)}."); }
public async Task HandledByIsAcknowledgeAfterAcknowledgeIsCalled() { var message = new FakeReceiverMessage("Hello, world!"); await message.AcknowledgeAsync(); message.HandledBy.Should().Be(nameof(message.AcknowledgeAsync)); }
public async Task HandledIsTrueAfterAcknowledgeIsCalled() { var message = new FakeReceiverMessage("Hello, world!"); await message.AcknowledgeAsync(); message.Handled.Should().BeTrue(); }
public async Task RollbackThrowsIfHandledIsTrue() { using var message = new FakeReceiverMessage("Hello, world!"); await message.AcknowledgeAsync().ConfigureAwait(false); Func <Task> act = () => message.RollbackAsync(); await act.Should().ThrowAsync <InvalidOperationException>() .WithMessage($"Cannot {nameof(message.RollbackAsync)} message: the message has already been handled by {nameof(message.AcknowledgeAsync)}.").ConfigureAwait(false); }