public void When_There_Is_No_Message_In_The_Sql_Outbox()
        {
            _storedMessage = _sqlOutbox.Get(_messageEarliest.Id);

            //_should_return_a_empty_message
            _storedMessage.Header.MessageType.Should().Be(MessageType.MT_NONE);
        }
        public void When_Writing_A_Message_To_The_MSSQL_Outbox()
        {
            _storedMessage = _sqlOutbox.Get(_message.Id);

            //should read the message from the sql outbox
            _storedMessage.Body.Value.Should().Be(_message.Body.Value);
            //should read the header from the sql outbox
            _storedMessage.Header.Topic.Should().Be(_message.Header.Topic);
            _storedMessage.Header.MessageType.Should().Be(_message.Header.MessageType);
            _storedMessage.Header.TimeStamp.Should().Be(_message.Header.TimeStamp);
            _storedMessage.Header.HandledCount.Should().Be(0);        // -- should be zero when read from outbox
            _storedMessage.Header.DelayedMilliseconds.Should().Be(0); // -- should be zero when read from outbox
            _storedMessage.Header.CorrelationId.Should().Be(_message.Header.CorrelationId);
            _storedMessage.Header.ReplyTo.Should().Be(_message.Header.ReplyTo);
            _storedMessage.Header.ContentType.Should().Be(_message.Header.ContentType);


            //Bag serialization
            _storedMessage.Header.Bag.ContainsKey(_key1).Should().BeTrue();
            _storedMessage.Header.Bag[_key1].Should().Be(_value1);
            _storedMessage.Header.Bag.ContainsKey(_key2).Should().BeTrue();
            _storedMessage.Header.Bag[_key2].Should().Be(_value2);
            _storedMessage.Header.Bag.ContainsKey(_key3).Should().BeTrue();
            _storedMessage.Header.Bag[_key3].Should().Be(_value3);
            _storedMessage.Header.Bag.ContainsKey(_key4).Should().BeTrue();
            _storedMessage.Header.Bag[_key4].Should().Be(_value4);
            _storedMessage.Header.Bag.ContainsKey(_key5).Should().BeTrue();
            _storedMessage.Header.Bag[_key5].Should().Be(_value5);
        }
예제 #3
0
        public void When_Writing_Messages_To_The_Outbox()
        {
            _retrievedMessages = _sqlOutbox.Get();

            //should read first message last from the outbox
            _retrievedMessages.Last().Id.Should().Be(_messageEarliest.Id);
            //should read last message first from the outbox
            _retrievedMessages.First().Id.Should().Be(_messageLatest.Id);
            //should read the messages from the outbox
            _retrievedMessages.Should().HaveCount(3);
        }
        public void When_There_Are_Multiple_Messages_In_The_Outbox_And_A_Range_Is_Fetched()
        {
            _messages = _sqlOutbox.Get(1, 3);

            //should fetch 1 message
            _messages.Should().HaveCount(1);
            //should fetch expected message
            _messages.First().Header.Topic.Should().Be(_TopicLastMessage);
            //should not fetch null messages
            _messages.Should().NotBeNull();
        }
예제 #5
0
        public void When_Writing_Messages_To_The_Outbox()
        {
            _retrievedMessages = _sqlOutbox.Get();

            //_should_read_first_message_last_from_the__message_store
            _retrievedMessages.Last().Id.Should().Be(_messageEarliest.Id);
            //_should_read_last_message_first_from_the__message_store
            _retrievedMessages.First().Id.Should().Be(_messageLatest.Id);
            //_should_read_the_messages_from_the__message_store
            _retrievedMessages.Should().HaveCount(3);
        }
예제 #6
0
        public void When_Writing_A_Message_To_The_MSSQL_Outbox()
        {
            _storedMessage = _sqlOutbox.Get(_messageEarliest.Id);

            //_should_read_the_message_from_the__sql_outbox
            _storedMessage.Body.Value.Should().Be(_messageEarliest.Body.Value);
            //_should_read_the_message_header_first_bag_item_from_the__sql_outbox
            _storedMessage.Header.Bag.ContainsKey(_key1).Should().BeTrue();
            _storedMessage.Header.Bag[_key1].Should().Be(_value1);
            //_should_read_the_message_header_second_bag_item_from_the__sql_outbox
            _storedMessage.Header.Bag.ContainsKey(_key2).Should().BeTrue();
            _storedMessage.Header.Bag[_key2].Should().Be(_value2);
            //_should_read_the_message_header_timestamp_from_the__sql_outbox
            _storedMessage.Header.TimeStamp.Should().Be(_messageEarliest.Header.TimeStamp);
            //_should_read_the_message_header_topic_from_the__sql_outbox
            _storedMessage.Header.Topic.Should().Be(_messageEarliest.Header.Topic);
            //_should_read_the_message_header_type_from_the__sql_outbox
            _storedMessage.Header.MessageType.Should().Be(_messageEarliest.Header.MessageType);
        }