public void VerifyPeekInStack() { var actual = new StackUsingLinkedList(); actual.Push(12); actual.Push(14); actual.Push(16); Assert.AreEqual(3, actual.Count()); var value = actual.Peek(); Assert.AreEqual(16, value); Assert.AreEqual(3, actual.Count()); }
public void Count() { StackUsingLinkedList <int> stack = new StackUsingLinkedList <int>(); stack.Push(10); stack.Push(20); stack.Push(30); stack.Push(40); /* * 40 --- Top * 30 * 20 * 10 */ stack.Clear(); stack.Push(10); stack.Push(20); stack.Push(30); /* * 30 --- Top * 20 * 10 */ Assert.AreEqual(stack.Count(), 3); }
public void VerifyPushInStack() { var actual = new StackUsingLinkedList(); actual.Push(12); actual.Push(14); actual.Push(16); Assert.AreEqual(3, actual.Count()); }
public void Push() { StackUsingLinkedList <int> stack = new StackUsingLinkedList <int>(); stack.Push(10); stack.Push(20); stack.Push(30); stack.Push(40); /* * 40 --- Top * 30 * 20 * 10 */ Assert.AreEqual(stack.Peek(), 40); Assert.AreEqual(stack.Count(), 4); }