public async Task OnMessageReceived_SingleMessage_Queued() { var outboundMessage = new OutboundMessage <TestEventOne>( new TestEventOne { Content = "Test" }, new[] { new MessageHeader("header1", "value1"), new MessageHeader("header2", "value2") }, TestEndpoint.GetDefault()); outboundMessage.RawContent = new JsonMessageSerializer().Serialize(outboundMessage.Content, outboundMessage.Headers); await _connector.RelayMessage(outboundMessage); await _queue.Commit(); (await _queue.GetLength()).Should().Be(1); var queued = (await _queue.Dequeue(1)).First(); queued.Endpoint.Should().Be(outboundMessage.Endpoint); queued.Headers.Count().Should().Be(3); queued.Content.Should().BeEquivalentTo(new JsonMessageSerializer().Serialize(outboundMessage.Content, outboundMessage.Headers)); }
public async Task EnqueueTest() { Parallel.For(0, 3, _ => { _queue.Enqueue(_sampleOutboundMessage); }); (await _queue.GetLength()).Should().Be(0); }