Beispiel #1
0
        void Verify(TransportMessageBuilder builder, Action <TransportMessage, BasicDeliverEventArgs> assertion, string alternateQueueToReceiveOn = null)
        {
            var message = builder.Build();

            SendMessage(message);

            var result = Consume(message.Id, alternateQueueToReceiveOn);

            assertion(new MessageConverter().ToTransportMessage(result), result);
        }
        void Verify(TransportMessageBuilder builder, Action <TransportMessage, BasicDeliverEventArgs> assertion)
        {
            var message = builder.Build();

            SendMessage(message);

            var result = Consume(message.Id);

            assertion(RabbitMqTransportMessageExtensions.ToTransportMessage(result), result);
        }
        public void Should_not_send_message_if_ambient_tx_is_rolled_back()
        {
            var body = Encoding.UTF8.GetBytes("<TestMessage/>");

            var message = new TransportMessageBuilder().WithBody(body).Build();

            using (var tx = new TransactionScope())
            {
                SendMessage(message);
                Assert.Throws <InvalidOperationException>(() => Consume(message.Id));
            }

            Assert.Throws <InvalidOperationException>(() => Consume(message.Id));
        }
        public void Should_not_send_message_if_ambient_tx_is_rolled_back()
        {
            var body = Encoding.UTF8.GetBytes("<TestMessage/>");

            var message = new TransportMessageBuilder().WithBody(body).Build();

            using (var tx = new TransactionScope())
            {
                SendMessage(message);
                Assert.Throws<InvalidOperationException>(() => Consume(message.Id));
            }

            Assert.Throws<InvalidOperationException>(() => Consume(message.Id));
        }
        public void Should_defer_the_send_until_tx_commit_if_ambient_tx_exists()
        {
            var body  = Encoding.UTF8.GetBytes("<TestMessage/>");
            var body2 = Encoding.UTF8.GetBytes("<TestMessage2/>");

            var message  = new TransportMessageBuilder().WithBody(body).Build();
            var message2 = new TransportMessageBuilder().WithBody(body2).Build();

            using (var tx = new TransactionScope())
            {
                SendMessage(message);
                SendMessage(message2);
                Assert.Throws <InvalidOperationException>(() => Consume(message.Id));

                tx.Complete();
            }

            Assert.AreEqual(body, Consume(message.Id).Body, "Message should be in the queue");
            Assert.AreEqual(body2, Consume(message2.Id).Body, "Message2 should be in the queue");
        }
        public void Should_defer_the_send_until_tx_commit_if_ambient_tx_exists()
        {
            var body = Encoding.UTF8.GetBytes("<TestMessage/>");
            var body2 = Encoding.UTF8.GetBytes("<TestMessage2/>");

            var message = new TransportMessageBuilder().WithBody(body).Build();
            var message2 = new TransportMessageBuilder().WithBody(body2).Build();

            using (var tx = new TransactionScope())
            {
                SendMessage(message);
                SendMessage(message2);
                Assert.Throws<InvalidOperationException>(()=>Consume(message.Id));

                tx.Complete();
            }

            Assert.AreEqual(body, Consume(message.Id).Body,"Message should be in the queue");
            Assert.AreEqual(body2, Consume(message2.Id).Body, "Message2 should be in the queue");
        }
 void VerifyRabbit(TransportMessageBuilder builder, Action <BasicDeliverEventArgs> assertion)
 {
     Verify(builder, (t, r) => assertion(r));
 }
 void Verify(TransportMessageBuilder builder, Action <TransportMessage> assertion)
 {
     Verify(builder, (t, r) => assertion(t));
 }
Beispiel #9
0
 void VerifyRabbit(TransportMessageBuilder builder, Action <BasicDeliverEventArgs> assertion, string alternateQueueToReceiveOn = null)
 {
     Verify(builder, (t, r) => assertion(r), alternateQueueToReceiveOn);
 }
 void VerifyRabbit(TransportMessageBuilder builder, Action<BasicDeliverEventArgs> assertion)
 {
     Verify(builder, (t, r) => assertion(r));
 }
 void Verify(TransportMessageBuilder builder, Action<TransportMessage> assertion)
 {
     Verify(builder, (t, r) => assertion(t));
 }
        void Verify(TransportMessageBuilder builder, Action<TransportMessage, BasicDeliverEventArgs> assertion)
        {
            var message = builder.Build();

            SendMessage(message);

            var result = Consume(message.Id);

            assertion(RabbitMqTransportMessageExtensions.ToTransportMessage(result), result);
        }
 void VerifyRabbit(TransportMessageBuilder builder, Action<BasicDeliverEventArgs> assertion, string alternateQueueToReceiveOn = null)
 {
     Verify(builder, (t, r) => assertion(r), alternateQueueToReceiveOn);
 }
        void Verify(TransportMessageBuilder builder, Action<TransportMessage, BasicDeliverEventArgs> assertion,string alternateQueueToReceiveOn=null)
        {
            var message = builder.Build();

            SendMessage(message);

            var result = Consume(message.Id, alternateQueueToReceiveOn);

            assertion(new MessageConverter().ToTransportMessage(result), result);
        }