public async Task Should_show_that_the_specified_type_was_received() { var consumer = new PingPongConsumer(TestTimeout); var handle = Host.ConnectReceiveEndpoint("boring3", x => consumer.Configure(x)); await handle.Ready; try { var pingMessage = new PingMessage(); Bus.Publish(pingMessage); Bus.Publish(new PongMessage(pingMessage.CorrelationId)); consumer.Received.Select <PingMessage>().Any().ShouldBe(true); consumer.Received.Select <PongMessage>(received => received.Context.Message.CorrelationId == pingMessage.CorrelationId).Any().ShouldBe(true); } finally { await handle.StopAsync(); } }
public async Task Should_distinguish_multiple_events() { var consumer = new PingPongConsumer(TestTimeout); var handle = Host.ConnectReceiveEndpoint("boring", x => consumer.Configure(x)); await handle.Ready; try { var pingMessage = new PingMessage(); var pingMessage2 = new PingMessage(); Bus.Publish(pingMessage); Bus.Publish(pingMessage2); consumer.Received.Select <PingMessage>(received => received.Context.Message.CorrelationId == pingMessage.CorrelationId).Any().ShouldBe(true); consumer.Received.Select <PingMessage>(received => received.Context.Message.CorrelationId == pingMessage2.CorrelationId).Any().ShouldBe(true); } finally { await handle.StopAsync(); } }