public void TestEnqueue() { SQueue queue = new SQueue(new Node(0)); Node testNode = new Node(100); queue.Enqueue(testNode); Assert.Equal(testNode, queue.Peek().Next); }
public void TestDequeue() { Node testNode1 = new Node(100); Node testNode2 = new Node(999); SQueue queue = new SQueue(testNode1); queue.Enqueue(testNode2); Assert.True(queue.Dequeue() == testNode1 && queue.Peek() == testNode2); }
/// <summary> /// Displays the SQueue in the console. /// </summary> /// <param name="queue">The SQueue being displayed.</param> static void ViewQueue(SQueue queue) { Node node = queue.Peek(); Console.Write("FRONT --> "); while (node != null) { Console.Write($"{node.Value} --> "); node = node.Next; } Console.Write("NULL\n"); }