public void TestPushSingleValue() { var stack = new FixedSizeStackOfStrings(50); var testString = "hello stack"; stack.Push(testString); Assert.AreEqual(1, stack.Size); var result = stack.Pop(); Assert.AreEqual(testString, result); }
public void TestPushMultipleValues() { var stack = new FixedSizeStackOfStrings(50); var testString1 = "Hello Stack"; var testString2 = "Hello again, stack"; var testString3 = "We meet again, stack"; stack.Push(testString1); stack.Push(testString2); stack.Push(testString3); //ensure all strings are in stack Assert.AreEqual(3, stack.Size); Assert.AreEqual(testString3, stack.Pop()); Assert.AreEqual(testString2, stack.Pop()); Assert.AreEqual(testString1, stack.Pop()); //ensure stack is now empty Assert.AreEqual(0, stack.Size); }