public void DoesPeekRetrieveTopWhenStackHasOnlyOneElement() { LinkedListTypedStack stack = new LinkedListTypedStack(); stack.Push(1); int expected = 1; int actual = ((Node)stack.Peek()).Data; Assert.AreEqual(expected, actual); int expected_size = 1; int actual_size = stack.Size; Assert.AreEqual(expected_size, actual_size); }
public void DoesPeekRetrieveTopWhenStackIsNotEmpty() { LinkedListTypedStack stack = new LinkedListTypedStack(); stack.Push(1); stack.Push(2); int expected = 2; int actual = ((Node)stack.Peek()).Data; Assert.AreEqual(expected, actual); int expected_size = 2; int actual_size = stack.Size; Assert.AreEqual(expected_size, actual_size); }
public void DoesPeekThrowsExcetionWhenStackIsEmpty() { LinkedListTypedStack stack = new LinkedListTypedStack(); Node top = (Node)stack.Peek(); }