static void Main(string[] args) { Stack stack1 = new Stack(null); Stack stack2 = new Stack(null); Cue queue = new Cue(stack1, stack2); Node node1 = new Node(10); Node node2 = new Node(20); Node node3 = new Node(30); Node node4 = new Node(40); Node node5 = new Node(50); queue.Enqueue(node1); queue.Enqueue(node2); queue.Enqueue(node3); queue.Enqueue(node4); queue.Enqueue(node5); Console.WriteLine("Order of queue:"); Console.WriteLine(queue.Dequeue().Value); Console.WriteLine(queue.Dequeue().Value); Console.WriteLine(queue.Dequeue().Value); Console.WriteLine(queue.Dequeue().Value); Console.WriteLine(queue.Dequeue().Value); }
public void CanDequeueTwiceInARow() { Node node1 = new Node(10); Node node2 = new Node(20); Node node3 = new Node(30); Stack stack1 = new Stack(null); Stack stack2 = new Stack(null); Cue queue = new Cue(stack1, stack2); queue.Enqueue(node1); queue.Enqueue(node2); queue.Enqueue(node3); queue.Dequeue(); queue.Dequeue(); Assert.Equal(node3.Value, queue.Dequeue().Value); }
public void CanEnqueueANode() { Node node1 = new Node(10); Node node2 = new Node(20); Node node3 = new Node(30); Node node4 = new Node(40); Node node5 = new Node(50); Stack stack1 = new Stack(null); Stack stack2 = new Stack(null); Cue queue = new Cue(stack1, stack2); queue.Enqueue(node1); queue.Enqueue(node2); queue.Enqueue(node3); queue.Enqueue(node4); queue.Enqueue(node5); Assert.Equal(node1.Value, queue.Dequeue().Value); }
public void CanDequeueEnqueueOnlyOneNode() { Node node1 = new Node(10); Stack stack1 = new Stack(null); Stack stack2 = new Stack(null); Cue queue = new Cue(stack1, stack2); queue.Enqueue(node1); Assert.Equal(node1.Value, queue.Dequeue().Value); }