public async Task When_there_are_multiple_messages_and_some_are_recievied_and_Dispatched_bulk_Async() { await _sqlOutbox.AddAsync(_message); await Task.Delay(100); await _sqlOutbox.AddAsync(_message1); await Task.Delay(100); await _sqlOutbox.AddAsync(_message2); await Task.Delay(100); await _sqlOutbox.AddAsync(_message3); await Task.Delay(100); _messages = await _sqlOutbox.GetAsync(new[] { _message1.Id, _message2.Id }); //should fetch 1 message _messages.Should().HaveCount(2); //should fetch expected message _messages.Should().Contain(m => m.Id == _message1.Id); _messages.Should().Contain(m => m.Id == _message2.Id); await _sqlOutbox.MarkDispatchedAsync(_messages.Select(m => m.Id), DateTime.UtcNow); await Task.Delay(TimeSpan.FromSeconds(5)); var undispatchedMessages = await _sqlOutbox.OutstandingMessagesAsync(0); undispatchedMessages.Count().Should().Be(2); }
public async Task When_there_are_multiple_outstanding_messages_in_the_outbox_and_messages_within_an_interval_are_fetched_async() { var messages = await _mySqlOutboxSync.OutstandingMessagesAsync(millSecondsSinceSent : 0); messages.Should().NotBeNullOrEmpty(); messages.Should().HaveCount(3); }