public void Should_show_that_the_specified_type_was_received() { var consumer = new PingPongConsumer(TestTimeout); using (ConnectHandle handle = consumer.Connect(Bus)) { 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); } }
public void Should_show_that_the_specified_type_was_received() { var consumer = new PingPongConsumer(TestTimeout); using (ConnectHandle handle = consumer.Connect(Bus)) { 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); } }
public void Should_show_that_the_specified_type_was_received() { var consumer = new PingPongConsumer(); using (IUnsubscribeAction unsubscribe = consumer.Subscribe(LocalBus).Disposable()) { var pingMessage = new PingMessage(); LocalBus.Publish(pingMessage); LocalBus.Publish(new PongMessage(pingMessage.CorrelationId)); consumer.Received.Any<PingMessage>().ShouldBeTrue(); consumer.Received.Any<PongMessage>( (received, message) => message.CorrelationId == pingMessage.CorrelationId).ShouldBeTrue(); } }
public void Should_show_that_the_specified_type_was_received() { var consumer = new PingPongConsumer(); using (IUnsubscribeAction unsubscribe = consumer.Subscribe(LocalBus).Disposable()) { var pingMessage = new PingMessage(); LocalBus.Publish(pingMessage); LocalBus.Publish(new PongMessage(pingMessage.CorrelationId)); consumer.Received.Any <PingMessage>().ShouldBeTrue(); consumer.Received.Any <PongMessage>( (received, message) => message.CorrelationId == pingMessage.CorrelationId).ShouldBeTrue(); } }
public void Should_distinguish_multiple_events() { var consumer = new PingPongConsumer(TestTimeout); using (ConnectHandle handle = consumer.Connect(Bus)) { 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); } }
public void Should_distinguish_multiple_events() { var consumer = new PingPongConsumer(TestTimeout); using (ConnectHandle handle = consumer.Connect(Bus)) { 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); } }
public void Should_distinguish_multiple_events() { var consumer = new PingPongConsumer(); using (IUnsubscribeAction unsubscribe = consumer.Subscribe(LocalBus).Disposable()) { var pingMessage = new PingMessage(); var pingMessage2 = new PingMessage(); LocalBus.Publish(pingMessage); LocalBus.Publish(pingMessage2); consumer.Received.Any<PingMessage>( (received, message) => message.CorrelationId == pingMessage.CorrelationId).ShouldBeTrue(); consumer.Received.Any<PingMessage>( (received, message) => message.CorrelationId == pingMessage2.CorrelationId).ShouldBeTrue(); } }
public void Should_distinguish_multiple_events() { var consumer = new PingPongConsumer(); using (IUnsubscribeAction unsubscribe = consumer.Subscribe(LocalBus).Disposable()) { var pingMessage = new PingMessage(); var pingMessage2 = new PingMessage(); LocalBus.Publish(pingMessage); LocalBus.Publish(pingMessage2); consumer.Received.Any <PingMessage>( (received, message) => message.CorrelationId == pingMessage.CorrelationId).ShouldBeTrue(); consumer.Received.Any <PingMessage>( (received, message) => message.CorrelationId == pingMessage2.CorrelationId).ShouldBeTrue(); } }
public void A_component_should_be_subscribed_to_multiple_messages_on_the_pipeline() { PingPongConsumer consumer = MockRepository.GenerateMock <PingPongConsumer>(); _pipeline.ConnectConsumer <PingPongConsumer>(() => consumer); PipelineViewer.Trace(_pipeline); var ping = new PingMessage(); consumer.Expect(x => x.Consume(ping)); _pipeline.Dispatch(ping); var pong = new PongMessage(ping.CorrelationId); consumer.Expect(x => x.Consume(pong)); _pipeline.Dispatch(pong); consumer.VerifyAllExpectations(); }
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(); } }
public void A_component_should_be_subscribed_to_multiple_messages_on_the_pipeline() { PingPongConsumer consumer = MockRepository.GenerateMock <PingPongConsumer>(); _builder.Expect(x => x.GetInstance <PingPongConsumer>()).Return(consumer).Repeat.Twice(); _pipeline.Subscribe <PingPongConsumer>(); PipelineViewer.Trace(_pipeline); PingMessage ping = new PingMessage(); consumer.Expect(x => x.Consume(ping)); _pipeline.Dispatch(ping); PongMessage pong = new PongMessage(ping.CorrelationId); consumer.Expect(x => x.Consume(pong)); _pipeline.Dispatch(pong); _builder.VerifyAllExpectations(); consumer.VerifyAllExpectations(); }