示例#1
0
        public void Consuming_should_be_thread_safe()
        {
            var t1 = new Thread(Publish100Messages);
            var t2 = new Thread(Consume100Messages);

            t1.Start();
            t2.Start();

            Assert.IsTrue(consumer.WaitUntilDelivery(1000));
            Assert.AreEqual(200, consumer.Received.Count);
            Assert.AreElementsEqualIgnoringOrder(Enumerable.Range(0, 200), consumer.Received.Select(r => r.Value));
        }