public virtual void TestIterator() { IQueue4 queue = new NonblockingQueue(); string[] data = new string[] { "a", "b", "c", "d" }; for (int idx = 0; idx < data.Length; idx++) { AssertIterator(queue, data, idx); queue.Add(data[idx]); AssertIterator(queue, data, idx + 1); } }
public virtual void TestNext() { IQueue4 queue = new NonblockingQueue(); string[] data = new string[] { "a", "b", "c" }; queue.Add(data[0]); Assert.AreSame(data[0], queue.Next()); queue.Add(data[1]); queue.Add(data[2]); AssertNext(new object[] { data[1], data[2] }, queue); }
private IQueue4 NewQueue(object[] items) { NonblockingQueue queue = new NonblockingQueue(); for (int i = 0; i < items.Length; i++) { queue.Add(items[i]); } return queue; }