Ejemplo n.º 1
0
        public void SpecifyAtLeastOneDownstream()
        {
            var destination = Substitute.For <IUpstreamHandler>();
            var pipeline    = new Decoupled.Pipeline.Pipeline();

            Assert.Throws <InvalidOperationException>(() => pipeline.Start());
        }
Ejemplo n.º 2
0
        public void SpecifyAtLeastOneDownstream()
        {
            var destination = Substitute.For<IUpstreamHandler>();
            var pipeline = new Decoupled.Pipeline.Pipeline();

            Assert.Throws<InvalidOperationException>(() => pipeline.Start());
        }
Ejemplo n.º 3
0
        public void Destination_IsInvoked()
        {
            var handler = Substitute.For<IUpstreamHandler>();
            var downHandler = Substitute.For<IDownstreamHandler>();
            var pipeline = new Decoupled.Pipeline.Pipeline();
            var context = new DownstreamContext(downHandler);
            var msg = Substitute.For<IUpstreamMessage>();

            pipeline.Add(context);
            pipeline.Add(new UpstreamContext(handler));
            pipeline.Start();
            context.SendUpstream(msg);

            handler.Received().HandleUpstream(Arg.Any<IUpstreamContext>(), msg);
        }
Ejemplo n.º 4
0
        public void Destination_IsInvoked()
        {
            var handler     = Substitute.For <IUpstreamHandler>();
            var downHandler = Substitute.For <IDownstreamHandler>();
            var pipeline    = new Decoupled.Pipeline.Pipeline();
            var context     = new DownstreamContext(downHandler);
            var msg         = Substitute.For <IUpstreamMessage>();

            pipeline.Add(context);
            pipeline.Add(new UpstreamContext(handler));
            pipeline.Start();
            context.SendUpstream(msg);

            handler.Received().HandleUpstream(Arg.Any <IUpstreamContext>(), msg);
        }
Ejemplo n.º 5
0
        public void DestinationIsNotSet()
        {
            var upContext = new UpstreamContext(new ForwardingUpHandler());
            var destination = Substitute.For<IUpstreamHandler>();
            var downHandler = Substitute.For<IDownstreamHandler>();
            var downContext = new DownstreamContext(downHandler);
            var pipeline = new Decoupled.Pipeline.Pipeline();
            var msg = Substitute.For<IUpstreamMessage>();

            pipeline.Add(downContext);
            pipeline.Add(upContext);
            pipeline.Add(new UpstreamContext(destination));
            pipeline.Start();
            upContext.Invoke(msg);

            destination.Received().HandleUpstream(Arg.Any<IUpstreamContext>(), msg);
        }
Ejemplo n.º 6
0
        public void DestinationIsNotSet()
        {
            var upContext   = new UpstreamContext(new ForwardingUpHandler());
            var destination = Substitute.For <IUpstreamHandler>();
            var downHandler = Substitute.For <IDownstreamHandler>();
            var downContext = new DownstreamContext(downHandler);
            var pipeline    = new Decoupled.Pipeline.Pipeline();
            var msg         = Substitute.For <IUpstreamMessage>();

            pipeline.Add(downContext);
            pipeline.Add(upContext);
            pipeline.Add(new UpstreamContext(destination));
            pipeline.Start();
            upContext.Invoke(msg);

            destination.Received().HandleUpstream(Arg.Any <IUpstreamContext>(), msg);
        }
Ejemplo n.º 7
0
 public void NotStarted()
 {
     var pipeline = new Decoupled.Pipeline.Pipeline();
     Assert.Throws<InvalidOperationException>(() => pipeline.Send(new DispatchCommand(new FakeCommand())));
 }
Ejemplo n.º 8
0
        public void NotStarted()
        {
            var pipeline = new Decoupled.Pipeline.Pipeline();

            Assert.Throws <InvalidOperationException>(() => pipeline.Send(new DispatchCommand(new FakeCommand())));
        }