public void CanThrowExceptionIfThereIsNothingToDequeue() { MyPseudoQueue ps = new MyPseudoQueue(); ps.PseudoQueue(); Assert.Throws <Exception>(() => ps.PseudoQueueDequeue()); }
public void CanEnqueueOneNodeToPseudoQueue() { MyPseudoQueue <string> myPseudoQueue = new MyPseudoQueue <string>(); Node <string> node1 = new Node <string>("One"); myPseudoQueue.Enqueue(node1); Assert.Equal("One", myPseudoQueue.Peek().Value); }
public void CanInstantiatePseudoQueue() { MyPseudoQueue ps = new MyPseudoQueue(); ps.PseudoQueue(); bool expected = ps.FirstStack.IsEmpty(); Assert.True(expected); }
public void CanInsertNodeIntoAPseudoQueue() { MyPseudoQueue ps = new MyPseudoQueue(); ps.PseudoQueue(); ps.PseudoQueueEnqueue(23); int expected = ps.FirstStack.Top.Value; Assert.Equal(23, expected); }
public void DequeueWhileQueueIsEmptyWillReturnNull() { MyPseudoQueue <string> myPseudoQueue = new MyPseudoQueue <string>(); Node <string> node1 = new Node <string>("One"); myPseudoQueue.Enqueue(node1); myPseudoQueue.Dequeue(); Node <string> recoveredData = myPseudoQueue.Dequeue(); Assert.Null(recoveredData); }
public void PseudoQueueIsEmptyAfterLastPop() { MyPseudoQueue ps = new MyPseudoQueue(); ps.PseudoQueue(); ps.PseudoQueueEnqueue(20); ps.PseudoQueueDequeue(); bool actual = ps.FirstStack.IsEmpty(); Assert.True(actual); }
public void CanDequeueASingleNodeValueFromPseudoQueue() { MyPseudoQueue ps = new MyPseudoQueue(); ps.PseudoQueue(); ps.PseudoQueueEnqueue(20); int expected = 20; int actual = ps.PseudoQueueDequeue(); Assert.Equal(actual, expected); }
public void CanEnqueueMultipleNodesToPseudoQueue() { MyPseudoQueue <string> myPseudoQueue = new MyPseudoQueue <string>(); Node <string> node1 = new Node <string>("One"); Node <string> node2 = new Node <string>("Two"); Node <string> node3 = new Node <string>("Three"); myPseudoQueue.Enqueue(node1); myPseudoQueue.Enqueue(node2); myPseudoQueue.Enqueue(node3); Assert.Equal("Three", myPseudoQueue.Peek().Value); }
public void CanRecoverDataFromDequeuedNode() { MyPseudoQueue <string> myPseudoQueue = new MyPseudoQueue <string>(); Node <string> node1 = new Node <string>("One"); Node <string> node2 = new Node <string>("Two"); Node <string> node3 = new Node <string>("Three"); myPseudoQueue.Enqueue(node1); myPseudoQueue.Enqueue(node2); myPseudoQueue.Enqueue(node3); Node <string> recoveredData = myPseudoQueue.Dequeue(); Assert.Equal("Three", recoveredData.Value); }
public void CanDequeueFirstNodeValueFromPseudoQueueWithMultipleNodes() { MyPseudoQueue ps = new MyPseudoQueue(); ps.PseudoQueue(); ps.PseudoQueueEnqueue(5); ps.PseudoQueueEnqueue(10); ps.PseudoQueueEnqueue(15); ps.PseudoQueueEnqueue(20); int expected = 20; int actual = ps.PseudoQueueDequeue(); Assert.Equal(actual, expected); }
public void CanDequeueAllNodesFromPseudoQueue() { MyPseudoQueue <string> myPseudoQueue = new MyPseudoQueue <string>(); Node <string> node1 = new Node <string>("One"); Node <string> node2 = new Node <string>("Two"); Node <string> node3 = new Node <string>("Three"); myPseudoQueue.Enqueue(node1); myPseudoQueue.Enqueue(node2); myPseudoQueue.Enqueue(node3); myPseudoQueue.Dequeue(); myPseudoQueue.Dequeue(); myPseudoQueue.Dequeue(); Assert.Null(myPseudoQueue.Peek()); }
public void CanInsertMulitpleNodesIntoAPseudoQueue() { MyPseudoQueue ps = new MyPseudoQueue(); ps.PseudoQueue(); ps.PseudoQueueEnqueue(20); ps.PseudoQueueEnqueue(15); ps.PseudoQueueEnqueue(10); ps.PseudoQueueEnqueue(5); int[] expected = { ps.FirstStack.Top.Next.Next.Next.Value, ps.FirstStack.Top.Next.Next.Value, ps.FirstStack.Top.Next.Value, ps.FirstStack.Top.Value }; int[] actual = { 5, 10, 15, 20 }; Assert.Equal(actual, expected); }
public void CanInstantiateEmptyPseudoQueue() { MyPseudoQueue <string> myPseudoQueue = new MyPseudoQueue <string>(); Assert.Null(myPseudoQueue.Peek()); }