public DequeueNoWait ( ) : |
||
return |
public void TestEnqueueFront() { FifoMessageDispatchChannel channel = new FifoMessageDispatchChannel(); MessageDispatch dispatch1 = new MessageDispatch(); MessageDispatch dispatch2 = new MessageDispatch(); channel.Start(); 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.DequeueNoWait() == dispatch2 ); Assert.IsTrue( channel.DequeueNoWait() == dispatch1 ); }
public void TestDequeueNoWait() { FifoMessageDispatchChannel channel = new FifoMessageDispatchChannel(); MessageDispatch dispatch1 = new MessageDispatch(); MessageDispatch dispatch2 = new MessageDispatch(); MessageDispatch dispatch3 = new MessageDispatch(); Assert.IsTrue( channel.Running == false ); Assert.IsTrue( channel.DequeueNoWait() == null ); channel.Enqueue( dispatch1 ); channel.Enqueue( dispatch2 ); channel.Enqueue( dispatch3 ); Assert.IsTrue( channel.DequeueNoWait() == null ); channel.Start(); Assert.IsTrue( channel.Running == true ); Assert.IsTrue( channel.Empty == false ); Assert.IsTrue( channel.Count == 3 ); Assert.IsTrue( channel.DequeueNoWait() == dispatch1 ); Assert.IsTrue( channel.DequeueNoWait() == dispatch2 ); Assert.IsTrue( channel.DequeueNoWait() == dispatch3 ); Assert.IsTrue( channel.Count == 0 ); Assert.IsTrue( channel.Empty == true ); }