Esempio n. 1
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();
        }
        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();
        }