public void TestDequeue()
        {
            MessageDispatchChannel channel = new MessageDispatchChannel();

            MessageDispatch dispatch1 = new MessageDispatch();
            MessageDispatch dispatch2 = new MessageDispatch();
            MessageDispatch dispatch3 = new MessageDispatch();

            channel.Start();
            Assert.IsTrue(channel.Running == true);

            DateTime timeStarted = DateTime.Now;

            Assert.IsTrue(channel.Dequeue(TimeSpan.FromMilliseconds(1000)) == null);

            DateTime timeFinished = DateTime.Now;

            TimeSpan elapsed = timeFinished - timeStarted;

            Assert.IsTrue(elapsed.TotalMilliseconds >= 999);

            channel.Enqueue(dispatch1);
            channel.Enqueue(dispatch2);
            channel.Enqueue(dispatch3);
            Assert.IsTrue(channel.Empty == false);
            Assert.IsTrue(channel.Count == 3);
            Assert.IsTrue(channel.Dequeue(TimeSpan.FromMilliseconds(Timeout.Infinite)) == dispatch1);
            Assert.IsTrue(channel.Dequeue(TimeSpan.Zero) == dispatch2);
            Assert.IsTrue(channel.Dequeue(TimeSpan.FromMilliseconds(1000)) == dispatch3);

            Assert.IsTrue(channel.Count == 0);
            Assert.IsTrue(channel.Empty == true);
        }