예제 #1
0
        public void IsEmptyNewStack_ReturnsTrue()
        {
            Stack stack = new Stack();
            bool expected = true;

            bool actual = stack.IsEmpty();

            Assert.AreEqual(expected, actual, "New Stack is not empty");
        }
예제 #2
0
        public void IsEmptyPoppedStack_ReturnsTrue()
        {
            Stack stack = new Stack();
            stack.Push("one");
            stack.Pop();

            bool expected = true;

            bool actual = stack.IsEmpty();

            Assert.AreEqual(expected, actual, "The popped stack is not empty");
        }
예제 #3
0
        public void PushPeek_RetainsPeekValue()
        {
            Stack stack = new Stack();

            String pushed = "one";
            stack.Push(pushed);
            stack.Peek();
            bool expectedBool = false;

            bool actualBool = stack.IsEmpty();

            Assert.AreEqual(expectedBool, actualBool, "Peeked value not on top of stack");
        }
예제 #4
0
        public void PushedStackIsEmpty_ReturnsFalse()
        {
            Stack stack = new Stack();
            stack.Push("one");

            bool expected = false;

            bool actual = stack.IsEmpty();

            Assert.AreEqual(expected, actual, "The pushed stack is empty");
        }
예제 #5
0
        public void PushPop_DeletesPopValue()
        {
            Stack stack = new Stack();

            String pushed = "one";
            stack.Push(pushed);
            stack.Pop();
            bool expectedBool = true;
            bool actualBool = stack.IsEmpty();

            Assert.AreEqual(expectedBool, actualBool, "Popped value not deleted");
        }