示例#1
0
		public void Should_have_the_bits_without_the_message_first()
		{
			var engine = new DynamicRoutingEngine(new PoolFiber());
			var visualizer = new TraceRoutingEngineVisualizer();

			var received = new Future<A>();
			engine.Configure(x => x.Receive<A>(received.Complete));

			var block = new Future<int>();
			engine.Add(0, () =>
				{
					visualizer.Show(engine);
					block.Complete(0);
				});
			block.WaitUntilCompleted(2.Seconds());

			engine.Send(new A());
			received.WaitUntilCompleted(2.Seconds());

			engine.Send(new B());

			var receivedB = new Future<B>();
			engine.Configure(x => x.Receive<B>(receivedB.Complete));

			received.WaitUntilCompleted(8.Seconds()).ShouldBeTrue();
			receivedB.WaitUntilCompleted(8.Seconds()).ShouldBeTrue();

			//engine.Receive<A, B>(x => { });

			visualizer.Show(engine);
		}
示例#2
0
        public void Should_have_the_bits_without_the_message_first()
        {
            var engine     = new DynamicRoutingEngine(new PoolFiber());
            var visualizer = new TraceRoutingEngineVisualizer();

            var received = new Future <A>();

            engine.Configure(x => x.Receive <A>(received.Complete));

            var block = new Future <int>();

            engine.Add(0, () =>
            {
                visualizer.Show(engine);
                block.Complete(0);
            });
            block.WaitUntilCompleted(2.Seconds());

            engine.Send(new A());
            received.WaitUntilCompleted(2.Seconds());

            engine.Send(new B());

            var receivedB = new Future <B>();

            engine.Configure(x => x.Receive <B>(receivedB.Complete));

            received.WaitUntilCompleted(8.Seconds()).ShouldBeTrue();
            receivedB.WaitUntilCompleted(8.Seconds()).ShouldBeTrue();

            //engine.Receive<A, B>(x => { });

            visualizer.Show(engine);
        }
示例#3
0
		public void Should_result_in_two_paths_through_the_routing_engine()
		{
			var foundA = new Future<AlphaNode<Message<A>>>();
			var foundRequestA = new Future<AlphaNode<Request<A>>>();

			new MatchAlphaNode<Message<A>>(_engine, foundA.Complete);
			new MatchAlphaNode<Request<A>>(_engine, foundRequestA.Complete);

			foundRequestA.IsCompleted.ShouldBeTrue("Could not find request alpha node");
			foundA.IsCompleted.ShouldBeTrue("Could not find body alpha node");

			var visualizer = new TraceRoutingEngineVisualizer();
			visualizer.Show(_engine);
		}
示例#4
0
        public void Should_result_in_two_paths_through_the_routing_engine()
        {
            var foundA        = new Future <AlphaNode <Message <A> > >();
            var foundRequestA = new Future <AlphaNode <Request <A> > >();

            new MatchAlphaNode <Message <A> >(_engine, foundA.Complete);
            new MatchAlphaNode <Request <A> >(_engine, foundRequestA.Complete);

            foundRequestA.IsCompleted.ShouldBeTrue("Could not find request alpha node");
            foundA.IsCompleted.ShouldBeTrue("Could not find body alpha node");

            var visualizer = new TraceRoutingEngineVisualizer();

            visualizer.Show(_engine);
        }
示例#5
0
		public void Should_display_the_empty_network()
		{
			var received = new Future<A>();

			var engine = new DynamicRoutingEngine(new PoolFiber());

			engine.Send(new A());

			Trace.WriteLine("Before Receive");
			var visualizer = new TraceRoutingEngineVisualizer();
			visualizer.Show(engine);

			engine.Configure(x => x.Receive<A>(received.Complete));

			Trace.WriteLine("After Receive");
			visualizer.Show(engine);

			received.WaitUntilCompleted(2.Seconds()).ShouldBeTrue();
		}
示例#6
0
        public void Should_display_the_empty_network()
        {
            var received = new Future <A>();

            var engine = new DynamicRoutingEngine(new PoolFiber());

            engine.Send(new A());

            Trace.WriteLine("Before Receive");
            var visualizer = new TraceRoutingEngineVisualizer();

            visualizer.Show(engine);

            engine.Configure(x => x.Receive <A>(received.Complete));

            Trace.WriteLine("After Receive");
            visualizer.Show(engine);

            received.WaitUntilCompleted(2.Seconds()).ShouldBeTrue();
        }
示例#7
0
        public void Show_me_the_graph()
        {
            var visualizer = new TraceRoutingEngineVisualizer();

            visualizer.Show(_engine);
        }
示例#8
0
		public void Show_me_the_graph()
		{
			var visualizer = new TraceRoutingEngineVisualizer();
			visualizer.Show(_engine);
		}