Ejemplo n.º 1
0
        public async Task HandledByIsRejectAfterRejectIsCalled()
        {
            var message = new FakeReceiverMessage("Hello, world!");

            await message.RejectAsync();

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

            await message.RejectAsync();

            message.Handled.Should().BeTrue();
        }
Ejemplo n.º 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)}.");
        }