Beispiel #1
0
        public void can_wait_for_multiple_messages_of_a_type()
        {
            using (var tq = new TestQueue(_dispatcher))
            {
                var evt  = new TestEvent();
                var evt2 = new TestEvent();
                _dispatcher.Publish(evt);
                _dispatcher.Publish(evt2);

                tq.WaitForMultiple <TestEvent>(2, TimeSpan.FromMilliseconds(100));
                Assert.Throws <TimeoutException>(() => tq.WaitForMultiple <TestEvent>(3, TimeSpan.FromMilliseconds(100)));
                tq.AssertNext <TestEvent>(evt.CorrelationId)
                .AssertNext <TestEvent>(evt2.CorrelationId)
                .AssertEmpty();
            }
        }