Example #1
0
        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());
        }
Example #2
0
        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());
        }