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

            await message.RejectAsync();

            message.HandledBy.Should().Be(nameof(message.RejectAsync));
        }
Exemple #2
0
        public async Task HandledIsTrueAfterRejectIsCalled()
        {
            var message = new FakeReceiverMessage("Hello, world!");

            await message.RejectAsync();

            message.Handled.Should().BeTrue();
        }
Exemple #3
0
        public async Task RejectThrowsIfHandledIsTrue()
        {
            var message = new FakeReceiverMessage("Hello, world!");

            await message.AcknowledgeAsync();

            Func <Task> act = () => message.RejectAsync();

            act.Should().Throw <InvalidOperationException>()
            .WithMessage($"Cannot {nameof(message.RejectAsync)} message: the message has already been handled by {nameof(message.AcknowledgeAsync)}.");
        }