コード例 #1
0
ファイル: Routing_Specs.cs プロジェクト: Nangal/Stact
        public void Should_properly_invoke_the_message_receiver()
        {
            var fiber = new PoolFiber();
            _engine = new DynamicRoutingEngine(fiber);

            _receivedA = new Future<A>();
            _receivedB = new Future<B>();
            _receivedC = new Future<C>();
            _receivedMessageB = new Future<Message<B>>();
            _receivedMessageC = new Future<Message<C>>();

            _engine.Configure(x =>
                {
                    x.Receive<A>(_receivedA.Complete);
                    x.Receive<B>(_receivedB.Complete);
                    x.Receive<C>(_receivedC.Complete);
                    x.Receive<Message<B>>(_receivedMessageB.Complete);
                    x.Receive<Message<C>>(_receivedMessageC.Complete);
                });

            _engine.Send(new B());
            _engine.Send(new C());
            _engine.Send(new B());
            _engine.Send(new C());

            fiber.Shutdown(5.Minutes());
        }
コード例 #2
0
ファイル: Routing_Specs.cs プロジェクト: yonglehou/Stact
        public void Should_properly_invoke_the_message_receiver()
        {
            var fiber = new PoolFiber();

            _engine = new DynamicRoutingEngine(fiber);

            _receivedA        = new Future <A>();
            _receivedB        = new Future <B>();
            _receivedC        = new Future <C>();
            _receivedMessageB = new Future <Message <B> >();
            _receivedMessageC = new Future <Message <C> >();

            _engine.Configure(x =>
            {
                x.Receive <A>(_receivedA.Complete);
                x.Receive <B>(_receivedB.Complete);
                x.Receive <C>(_receivedC.Complete);
                x.Receive <Message <B> >(_receivedMessageB.Complete);
                x.Receive <Message <C> >(_receivedMessageC.Complete);
            });

            _engine.Send(new B());
            _engine.Send(new C());
            _engine.Send(new B());
            _engine.Send(new C());

            fiber.Shutdown(5.Minutes());
        }