public void DoesPopMethodRetrieveTopWhenStackHasOnlyOneElement() { LinkedListTypedStack stack = new LinkedListTypedStack(); stack.Push(1); int expected = 1; int actual = ((Node)stack.Pop()).Data; Assert.AreEqual(expected, actual); Assert.AreEqual(true, stack.IsEmpty()); Assert.IsNull(stack.Top); }
public void DoesPopRetrieveTopWhenStackIsNotEmpty() { LinkedListTypedStack stack = new LinkedListTypedStack(); stack.Push(1); stack.Push(2); int expected = 2; int actual = ((Node)stack.Pop()).Data; Assert.AreEqual(expected, actual); int expected_size = 1; int actual_size = stack.Size; Assert.AreEqual(expected_size, actual_size); int expected_new_top_val = 1; int actual_new_top_val = ((Node)stack.Top).Data; Assert.AreEqual(expected_new_top_val, actual_new_top_val); }
public void DoesPopThrowsExcetionWhenStackIsEmpty() { LinkedListTypedStack stack = new LinkedListTypedStack(); Node top = (Node)stack.Pop(); }