/// <summary> /// testing out new Queue /// </summary> static void QueueWithStacks() { Queue TestQueue = new Queue(); TestQueue.Enqueue(new Node("Papa")); Console.WriteLine($"Made a Queue and its first value is {TestQueue.Peek().Data}"); TestQueue.Enqueue(new Node("Can")); TestQueue.Enqueue(new Node("You")); TestQueue.Enqueue(new Node("Hear")); TestQueue.Enqueue(new Node("Me?")); Console.WriteLine($"Adding some more nodes with string \" Can You Hear Me \" and its first value should still be {TestQueue.Peek().Data}"); TestQueue.Dequeue(); Console.WriteLine($"Removing the front node and its value should be {TestQueue.Peek().Data}"); TestQueue.Dequeue(); Console.WriteLine($"Removing the front node and its value should be {TestQueue.Peek().Data}"); TestQueue.Dequeue(); Console.WriteLine($"Removing the front node and its value should be {TestQueue.Peek().Data}"); TestQueue.Dequeue(); Console.WriteLine($"Removing the front node and its value should be {TestQueue.Peek().Data}"); TestQueue.Enqueue(new Node("Can")); TestQueue.Enqueue(new Node("You")); TestQueue.Enqueue(new Node("Hear")); TestQueue.Enqueue(new Node("Me?")); Console.WriteLine($"Adding some more nodes with string \" Can You Hear Me \" and its first value should still be {TestQueue.Peek().Data}"); TestQueue.Dequeue(); Console.WriteLine($"Removing the front node and its value should be {TestQueue.Peek().Data}"); }
public void FIFOTestDequeue() { Node One = new Node("Papa"); Node Two = new Node("Mama"); Queue TestQueue = new Queue(); TestQueue.Enqueue(One); TestQueue.Enqueue(Two); TestQueue.Dequeue(); Assert.Equal(Two, TestQueue.Peek()); }