예제 #1
0
        public async Task HandledByIsRollbackAfterRollbackIsCalled()
        {
            var message = new FakeReceiverMessage("Hello, world!");

            await message.RollbackAsync();

            message.HandledBy.Should().Be(nameof(message.RollbackAsync));
        }
예제 #2
0
        public async Task HandledIsTrueAfterRollbackIsCalled()
        {
            var message = new FakeReceiverMessage("Hello, world!");

            await message.RollbackAsync();

            message.Handled.Should().BeTrue();
        }
예제 #3
0
        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)}.");
        }