Пример #1
0
        public async Task RollbackCallsInnerMessageRollbackIfRollbackForwarderIsNull()
        {
            using var receiver           = new FakeReceiver();
            using var forwardingReceiver = new ForwardingReceiver("foo", receiver, rollbackForwarder: null);
            using var message            = new FakeReceiverMessage("Hello, world!");

            var forwardingMessage = new ForwardingReceiverMessage(forwardingReceiver, message);

            await forwardingMessage.RollbackAsync().ConfigureAwait(false);

            message.HandledBy.Should().Be(nameof(IReceiverMessage.RollbackAsync));
        }
Пример #2
0
        public async Task RollbackHandlesInnerMessageAccordingToRollbackOutcomeWhenRollbackForwarderIsNotNull(ForwardingOutcome outcome)
        {
            using var forwarder = new FakeSender();

            using var receiver           = new FakeReceiver();
            using var forwardingReceiver = new ForwardingReceiver("foo", receiver, rollbackForwarder: forwarder, rollbackOutcome: outcome);
            using var message            = new FakeReceiverMessage("Hello, world!");

            var forwardingMessage = new ForwardingReceiverMessage(forwardingReceiver, message);

            await forwardingMessage.RollbackAsync().ConfigureAwait(false);

            message.HandledBy.Should().Be($"{outcome}Async");
        }
Пример #3
0
        public async Task RollbackSendsMessageToRollbackForwarderWhenRollbackForwarderIsNotNull()
        {
            using var forwarder = new FakeSender();

            using var receiver           = new FakeReceiver();
            using var forwardingReceiver = new ForwardingReceiver("foo", receiver, rollbackForwarder: forwarder);
            using var message            = new FakeReceiverMessage("Hello, world!");

            var forwardingMessage = new ForwardingReceiverMessage(forwardingReceiver, message);

            await forwardingMessage.RollbackAsync().ConfigureAwait(false);

            forwarder.SentMessages.Should().ContainSingle();
            forwarder.SentMessages[0].StringPayload.Should().Be("Hello, world!");
        }