Example #1
0
        public void ChildrenOrderTest()
        {
            const int sourcesCount = 5;
            IMessageSource <TestMessage> source = MessageGenerator.CreateCompositeSource(TestRouterHelper.SourceName, sourcesCount, TestRouterHelper.MessagesCountToGenerate);
            var waiter  = new Waiter(sourcesCount);
            var factory = new TestRouterFactory(waiter, messages => messages.CheckOrder(TestRouterHelper.Sequence(0, TestRouterHelper.MessagesCountToGenerate)));

            using (IMessageConsumer <TestMessage> router = factory.CreateRouter(source, factory, m => m.Tag))
            {
                router.Consume(TestRouterHelper.HandleMessage);
                waiter.Wait(true);
                // we compare to 55, not 50, because each source has stop message at the end.
                ((TestMessageRouter)router).ReceiveCallCount.Should(Be.EqualTo(55));
            }
        }