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);
            }
        }
Пример #2
0
        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);
            }
        }
Пример #3
0
        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();
            }
        }
Пример #4
0
        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);
            }
        }
Пример #6
0
        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);
            }
        }
Пример #7
0
        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();
            }
        }
Пример #8
0
        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();
            }
        }
Пример #9
0
        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();
        }
Пример #10
0
        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();
            }
        }
Пример #11
0
        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();
            }
        }
Пример #12
0
        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();
        }