Пример #1
0
        public void When_there_is_no_message_in_the_dynamo_db_outbox()
        {
            _storedMessage = _dynamoDbOutbox.Get(_messageEarliest.Id);

            //_should_return_a_empty_message
            _storedMessage.Header.MessageType.Should().Be(MessageType.MT_NONE);
        }
        public void When_writing_a_message_to_the_dynamo_db_outbox()
        {
            _storedMessage = _dynamoDbOutbox.Get(_messageEarliest.Id);

            //should read the message from the sql outbox
            _storedMessage.Body.Value.Should().Be(_messageEarliest.Body.Value);
            //should read the header from the sql outbox
            _storedMessage.Header.Topic.Should().Be(_messageEarliest.Header.Topic);
            _storedMessage.Header.MessageType.Should().Be(_messageEarliest.Header.MessageType);
            _storedMessage.Header.TimeStamp.Should().Be(_messageEarliest.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(_messageEarliest.Header.CorrelationId);
            _storedMessage.Header.ReplyTo.Should().Be(_messageEarliest.Header.ReplyTo);
            _storedMessage.Header.ContentType.Should().Be(_messageEarliest.Header.ContentType);


            //Bag serialization
            //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);
        }
Пример #3
0
        public void When_reading_message_by_time_range()
        {
            var retrievedMessages = DynamoDbOutbox.Get(_topic, _timeStamp, _timeStamp.AddHours(-3), _timeStamp.AddHours(-2));

            //_should_read_the_last_middle_message_from_the_store
            retrievedMessages.Should().HaveCount(1);
            retrievedMessages.Single().Should().Be(_message2);
        }
Пример #4
0
        public void When_reading_message_until_time()
        {
            var retrievedMessages = DynamoDbOutbox.Get(_topic, _timeStamp, endTime: _timeStamp.AddHours(-2));

            //_should_read_the_last_two_messages_from_the_store
            retrievedMessages.Should().HaveCount(2);
            retrievedMessages.FirstOrDefault(m => m.Id == _guids[0]).Should().NotBeNull();
            retrievedMessages.FirstOrDefault(m => m.Id == _guids[1]).Should().NotBeNull();
        }
Пример #5
0
        public void When_writing_a_message_to_the_dynamo_db_outbox()
        {
            _storedMessage = DynamoDbOutbox.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);
        }
Пример #6
0
        public void When_reading_messages_by_numerical_range()
        {
            var exception = Catch.Exception(() => DynamoDbOutbox.Get(3, 1));

            exception.Should().BeOfType <NotSupportedException>();
        }