public async Task When_Writing_A_Message_To_The_Outbox_Async() { await _mySqlOutbox.AddAsync(_messageEarliest); _storedMessage = await _mySqlOutbox.GetAsync(_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); }
public async Task When_There_Are_Multiple_Messages_In_The_Outbox_And_A_Range_Is_Fetched_Async() { await _mySqlOutbox.AddAsync(_messageEarliest); await Task.Delay(100); await _mySqlOutbox.AddAsync(_message1); await Task.Delay(100); await _mySqlOutbox.AddAsync(_message2); _messages = await _mySqlOutbox.GetAsync(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(); }
public async Task When_Writing_A_Message_To_The_Outbox_Async() { await _mySqlOutbox.AddAsync(_messageEarliest); _storedMessage = await _mySqlOutbox.GetAsync(_messageEarliest.Id); //_should_read_the_message_from_the__sql_message_store _storedMessage.Body.Value.Should().Be(_messageEarliest.Body.Value); //_should_read_the_message_header_first_bag_item_from_the__sql_message_store _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_message_store _storedMessage.Header.Bag.ContainsKey(key2).Should().BeTrue(); _storedMessage.Header.Bag[key2].Should().Be(value2); //_should_read_the_message_header_timestamp_from_the__sql_message_store _storedMessage.Header.TimeStamp.Should().Be(_messageEarliest.Header.TimeStamp); //_should_read_the_message_header_topic_from_the__sql_message_store = _storedMessage.Header.Topic.Should().Be(_messageEarliest.Header.Topic); //_should_read_the_message_header_type_from_the__sql_message_store _storedMessage.Header.MessageType.Should().Be(_messageEarliest.Header.MessageType); }