public void Stack_Peek_ThrowsExceptionIfStackIsEmpty() { Stack stack = new Stack(); stack.Peek(); }
public void Stack_Peek_ReturnsLastAddedItem() { Stack stack = new Stack(); String lastStackItemValue = "Last item value"; stack.Push("First item"); stack.Push("Second item"); stack.Push(lastStackItemValue); String peekValue = stack.Peek(); Assert.AreEqual(lastStackItemValue, peekValue); }
public void Stack_Peek_ThrowsExceptionIfPreviouslyPopulatedStackIsEmpty() { Stack stack = new Stack(); stack.Push("Some data"); stack.Push("More data"); stack.Pop(); stack.Pop(); stack.Peek(); }
public void Stack_Peek_DoesntRemoveNode() { Stack stack = new Stack(); stack.Push("First Item"); stack.Push("Second Item"); int countBeforePeeking = stack.Count(); stack.Peek(); int countAfterPeeking = stack.Count(); Assert.AreEqual(countBeforePeeking, countAfterPeeking); }