public async Task if_not_supporting_native_dead_letter_queues()
        {
            var root = new MockMessagingRoot();
            await theContinuation.Execute(root, theChannelCallback, theEnvelope, null, DateTime.UtcNow);

            await root.Persistence.Received().MoveToDeadLetterStorage(theEnvelope, theException);
        }
        public async Task logging_calls()
        {
            var root = new MockMessagingRoot();
            await theContinuation.Execute(root, theChannelCallback, theEnvelope, null, DateTime.UtcNow);

            root.MessageLogger.Received().MessageFailed(theEnvelope, theException);
            root.MessageLogger.Received().MovedToErrorQueue(theEnvelope, theException);
        }
        public async Task should_send_a_failure_ack()
        {
            var root = new MockMessagingRoot();
            await theContinuation.Execute(root, theChannelCallback, theEnvelope, null, DateTime.UtcNow);

            await root.Acknowledgements
            .Received()
            .SendFailureAcknowledgement(theEnvelope, $"Moved message {theEnvelope.Id} to the Error Queue.\n{theException}")
            ;
        }
        public async Task use_native_error_queue_if_exists()
        {
            var callback = Substitute.For <IChannelCallback, IHasDeadLetterQueue>();
            var root     = new MockMessagingRoot();

            await theContinuation.Execute(root, callback, theEnvelope, null, DateTime.UtcNow);

            await((IHasDeadLetterQueue)callback).Received().MoveToErrors(theEnvelope, theException);

            await root.Persistence.DidNotReceive().MoveToDeadLetterStorage(theEnvelope, theException);
        }
Example #5
0
        public void create_bus_for_envelope()
        {
            var root     = new MockMessagingRoot();
            var original = ObjectMother.Envelope();

            var bus = root.ContextFor(original);

            bus.Envelope.ShouldBe(original);
            bus.EnlistedInTransaction.ShouldBeTrue();

            bus.As <MessageContext>().Transaction.ShouldBeOfType <InMemoryEnvelopeTransaction>();
        }
Example #6
0
        public when_creating_a_service_bus_with_acknowledgement_required_envelope()
        {
            theEnvelope               = ObjectMother.Envelope();
            theEnvelope.Id            = Guid.NewGuid();
            theEnvelope.CorrelationId = Guid.NewGuid();
            theEnvelope.ReplyUri      = "tcp://server2:2000".ToUri();

            theEnvelope.AckRequested = true;

            var root = new MockMessagingRoot();
            var bus  = root.ContextFor(theEnvelope);

            theAcknowledgement = bus.As <MessageContext>().Outstanding.Single();
        }