public void TestPeek() { MessageDispatchChannel channel = new MessageDispatchChannel(); MessageDispatch dispatch1 = new MessageDispatch(); MessageDispatch dispatch2 = new MessageDispatch(); Assert.IsTrue(channel.Empty == true); Assert.IsTrue(channel.Count == 0); channel.EnqueueFirst(dispatch1); Assert.IsTrue(channel.Empty == false); Assert.IsTrue(channel.Count == 1); channel.EnqueueFirst(dispatch2); Assert.IsTrue(channel.Empty == false); Assert.IsTrue(channel.Count == 2); Assert.IsTrue(channel.Peek() == null); channel.Start(); Assert.IsTrue(channel.Peek() == dispatch2); Assert.IsTrue(channel.DequeueNoWait() == dispatch2); Assert.IsTrue(channel.Peek() == dispatch1); Assert.IsTrue(channel.DequeueNoWait() == dispatch1); }