public void Stack_PushCount_ReturnCount() { Stack stack = new Stack(); stack.Push("Testing1"); stack.Push("Testing2"); stack.Push("Testing3"); stack.Push("Testing4"); stack.Push("Testing5"); int expected = 5; int actual = stack.Count(); Assert.AreEqual(expected, actual); }
public void Stack_Pop_IsEmpty_Stack_ReturnsFalse() { Stack stack = new Stack(); stack.Push("Testing"); bool expected = false; bool actual = stack.isEmpty(); Assert.AreEqual(expected, actual); }
public void Stack_IsEmpty_Pop_Until_Empty_ReturnsTrue() { Stack stack = new Stack(); stack.Push("Testing"); while (!stack.isEmpty()) { stack.Pop(); } bool expected = true; bool actual = stack.isEmpty(); Assert.AreEqual(expected, actual); }
public void Stack_PushLargeAmountCount_ReturnCount() { Stack stack = new Stack(); for (int i = 0; i < 10000000; i++) { stack.Push("Testing"); } int expected = 10000000; int actual = stack.Count(); Assert.AreEqual(expected, actual); }
public void Stack_Push_PopPastEmpty_ThrowException() { Stack stack = new Stack(); stack.Push("Testing1"); stack.Push("Testing2"); stack.Push("Testing3"); stack.Push("Testing4"); stack.Push("Testing5"); //Loop one more than items in stack for (int i = 0; i < 6; i++) { stack.Pop(); } }
public void Stack_PushPopPeek_EmptyStack_ReturnLastString() { Stack stack = new Stack(); stack.Push("Testing1"); stack.Push("Testing2"); stack.Push("Testing3"); stack.Pop(); string expected = "Testing2"; string actual = stack.Peek(); Assert.AreEqual(expected, actual); }
public void Stack_PushPopCount_EmptyStack_ReturnCount() { Stack stack = new Stack(); stack.Push("Testing1"); stack.Push("Testing2"); stack.Pop(); int expected = 1; int actual = stack.Count(); Assert.AreEqual(expected, actual); }