static void Queue() { CustomQueue cq = new CustomQueue(20); cq.Enqueue(10); cq.Enqueue(20); cq.Enqueue(30); Console.WriteLine(cq.Count); var tmp = cq.GetItem(); for (int i = 0; i < tmp.Length; i++) { Console.WriteLine("Item -> " + tmp[i]); } cq.Dequeue(); Console.WriteLine("After Dequeuing : "); tmp = cq.GetItem(); for (int i = 0; i < tmp.Length; i++) { Console.WriteLine("Item -> " + tmp[i]); } cq.Enqueue(40); Console.WriteLine("After adding 40 : "); tmp = cq.GetItem(); for (int i = 0; i < tmp.Length; i++) { Console.WriteLine("Item -> " + tmp[i]); } }
private static void ProcessItems(CustomQueue <HardwareItem> customQueue) { while (customQueue.QueueLength > 0) { System.Threading.Thread.Sleep(3000); HardwareItem hardWareItem = customQueue.GetItem(); } }
public void Method1() { CustomQueue cq = new CustomQueue(); cq.Enqueue(10); cq.Enqueue(20); cq.Enqueue(30); Assert.AreEqual(3, cq.Count, 0); var tmp = cq.GetItem(); Assert.AreEqual(3, tmp.Length); }