Exemplo n.º 1
0
        public void Setup()
        {
            _endpoint = MockRepository.GenerateMock <IEndpoint>();
            _endpoint.Stub(x => x.Address.Uri).Return(_uri);

            _bus = MockRepository.GenerateMock <IServiceBus>();
            _bus.Stub(x => x.Endpoint).Return(_endpoint);

            _unsubscribe = MockRepository.GenerateMock <UnsubscribeAction>();

            _subscriptionEvent = MockRepository.GenerateMock <ISubscriptionEvent>();
            _pipeline          = InboundPipelineConfigurator.CreateDefault(_bus);
            _pipeline.Configure(x => x.Register(_subscriptionEvent));
        }
Exemplo n.º 2
0
        public void Should_dispatch_an_interface_via_the_pipeline()
        {
            var pipeline = InboundPipelineConfigurator.CreateDefault(null);

            var consumer = new TestMessageConsumer <IComplaintAdded>();

            pipeline.ConnectInstance(consumer);

            var             user      = new User("Chris", "*****@*****.**");
            IComplaintAdded complaint = new ComplaintAdded(user, "No toilet paper", BusinessArea.Appearance)
            {
                Body = "There was no toilet paper in the stall, forcing me to use my treasured issue of .NET Developer magazine."
            };

            pipeline.Dispatch(complaint);

            consumer.ShouldHaveReceivedMessage(complaint);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Creates an instance of the ServiceBus, which implements IServiceBus. This is normally
        /// not called and should be created using the ServiceBusConfigurator to ensure proper defaults
        /// and operation.
        /// </summary>
        public ServiceBus(IEndpoint endpointToListenOn,
                          IEndpointCache endpointCache)
        {
            ReceiveTimeout = TimeSpan.FromSeconds(3);
            Guard.AgainstNull(endpointToListenOn, "endpointToListenOn", "This parameter cannot be null");
            Guard.AgainstNull(endpointCache, "endpointFactory", "This parameter cannot be null");

            Endpoint      = endpointToListenOn;
            EndpointCache = endpointCache;

            _eventChannel = new ChannelAdapter();

            _serviceContainer = new ServiceContainer(this);

            OutboundPipeline = new OutboundPipelineConfigurator(this).Pipeline;
            InboundPipeline  = InboundPipelineConfigurator.CreateDefault(this);

            ControlBus = this;

            InitializePerformanceCounters();
        }
Exemplo n.º 4
0
 public void Setup()
 {
     _pipeline = InboundPipelineConfigurator.CreateDefault(null);
 }