Example #1
0
        public void Stack_IsEmpty_ReturnsFalseOnNonEmptyStackAfterMultiplePops()
        {
            Stack stack = new Stack();
            bool expectedIsEmptyReturnValue = false;

            stack.Push("Hello worldz");
            stack.Push("Hi again");
            stack.Push("Hi again, again");
            stack.Push("Hi again, but I'll be popped soon :(");

            stack.Pop();
            stack.Pop();

            bool actualIsEmptyReturnValue = stack.IsEmpty();

            Assert.AreEqual(expectedIsEmptyReturnValue, actualIsEmptyReturnValue);
        }
Example #2
0
        public void Stack_IsEmpty_ReturnsTrueOnPreviouslyPopulatedEmptyStack()
        {
            Stack stack = new Stack();
            bool expectedIsEmptyReturnValue = true;

            stack.Push("Dataz");
            stack.Push("More dataz");

            stack.Pop();
            stack.Pop();

            bool actualIsEmptyReturnValue = stack.IsEmpty();

            Assert.AreEqual(actualIsEmptyReturnValue, expectedIsEmptyReturnValue);
        }
Example #3
0
        public void Stack_IsEmpty_ReturnsFalseOnNonEmptyStack()
        {
            Stack stack = new Stack();
            bool expectedIsEmptyReturnValue = false;

            stack.Push("Hello worldz");
            stack.Push("Hi again");

            bool actualIsEmptyReturnValue = stack.IsEmpty();

            Assert.AreEqual(expectedIsEmptyReturnValue, actualIsEmptyReturnValue);
        }
Example #4
0
        public void Stack_IsEmpty_ReturnsTrueOnNewlyCreatedStack()
        {
            Stack stack = new Stack();
            bool expectedIsEmptyReturnValue = true;

            bool actualIsEmptyReturnValue = stack.IsEmpty();

            Assert.AreEqual(expectedIsEmptyReturnValue, actualIsEmptyReturnValue);
        }