示例#1
0
        public void When_reading_a_delayed_message_via_the_messaging_gateway()
        {
            _messageProducer.SendWithDelay(_message, 1000);

            var immediateResult = _client.Listen(waitForMilliseconds: 0, suppressDisposal: true);

            _immediateReadIsNull = immediateResult == null;

            var delayedResult = _client.Listen(waitForMilliseconds: 2000);

            _messageBody    = delayedResult.GetBody();
            _messageHeaders = delayedResult.GetHeaders();

            //_should_have_not_been_able_get_message_before_delay
            Assert.True(_immediateReadIsNull);
            //_should_send_a_message_via_rmq_with_the_matching_body
            Assert.AreEqual(_message.Body.Value, _messageBody);
            //_should_send_a_message_via_rmq_with_delay_header
            CollectionAssert.Contains(_messageHeaders.Keys, HeaderNames.DELAY_MILLISECONDS);
            //_should_received_a_message_via_rmq_with_delayed_header
            CollectionAssert.Contains(_messageHeaders.Keys, HeaderNames.DELAYED_MILLISECONDS);
        }
示例#2
0
        public void When_posting_a_message_via_the_messaging_gateway()
        {
            _messageProducer.Send(_message);

            var result = _client.Listen();

            _messageBody    = result.GetBody();
            _messageHeaders = result.GetHeaders();

            //_should_send_a_message_via_rmq_with_the_matching_body
            Assert.AreEqual(_message.Body.Value, _messageBody);
            //_should_send_a_message_via_rmq_without_delay_header
            CollectionAssert.DoesNotContain(_messageHeaders.Keys, HeaderNames.DELAY_MILLISECONDS);
            //_should_received_a_message_via_rmq_without_delayed_header
            CollectionAssert.DoesNotContain(_messageHeaders.Keys, HeaderNames.DELAYED_MILLISECONDS);
        }