예제 #1
0
 public void TestUpstreamOrder()
 {
     var pipeline = new Pipeline();
     pipeline.AddUpstreamHandler(new UpstreamOrderHandler(0));
     pipeline.AddUpstreamHandler(new UpstreamOrderHandler(1));
     pipeline.AddUpstreamHandler(new UpstreamOrderHandler(2));
     pipeline.SendUpstream(new MyMessage());
     Assert.Equal(3, UpstreamOrderHandler.CurrentIndex);
 }
예제 #2
0
 public void SendUpStreamAndSwitchToDown()
 {
     var pipeline = new Pipeline();
     IPipelineMessage downMsg = null;
     pipeline.AddUpstreamHandler(new MyUpHandler((ctx, m) =>
         {
             var upMsg = m;
             ctx.SendDownstream(upMsg);
         }));
     pipeline.AddDownstreamHandler(new MyDownHandler((ctx, m) => downMsg = m));
     pipeline.SendUpstream(new Disconnected(new Exception()));
     Assert.NotNull(downMsg);
 }