コード例 #1
0
        public void It_should_be_added_to_the_pipeline_for_remote_subscribers()
        {
            // okay, this is incredibly hard to mock due to the fact that the pipeline does NOT
            // perform the actual configuration. The visitor-based configurator is sweet, but mocking
            // it is just not happening. We'll use a real pipeline instead and verify that it actually
            // calls the methods instead.

            _consumer.SubscribedTo <PingMessage>(_remoteUri);

            var message = new PingMessage();

            _pipeline.Dispatch(message);

            _remoteEndpoint.AssertWasCalled(x => x.Send(message));
        }
コード例 #2
0
        public void The_endpoint_consumer_should_be_returned()
        {
            var endpoint = MockRepository.GenerateMock <IEndpoint>();

            endpoint.Stub(x => x.Address.Uri).Return(new Uri("rabbitmq://localhost/queue_name"));

            _pipeline.ConnectEndpoint <PingMessage>(endpoint);

            PipelineViewer.Trace(_pipeline);

            var message = new PingMessage();

            ISendContext <PingMessage> context = new SendContext <PingMessage>(message);

            endpoint.Expect(x => x.Send(context)).IgnoreArguments();

            _pipeline.Dispatch(message);

            endpoint.VerifyAllExpectations();
        }
コード例 #3
0
 public static bool Dispatch <T>(this IOutboundMessagePipeline pipeline, T message)
     where T : class
 {
     return(pipeline.Dispatch(message, x => true));
 }