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