public virtual void TestNext() { IQueue4 queue = new NonblockingQueue(); string[] data = { "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) { var queue = new NonblockingQueue(); for (var i = 0; i < items.Length; i++) { queue.Add(items[i]); } return(queue); }
public virtual void TestIterator() { IQueue4 queue = new NonblockingQueue(); string[] data = { "a", "b", "c", "d" }; for (var idx = 0; idx < data.Length; idx++) { AssertIterator(queue, data, idx); queue.Add(data[idx]); AssertIterator(queue, data, idx + 1); } }