Exemplo n.º 1
0
        public void PushCount_ReturnsCountOfPushed()
        {
            Stack stack = new Stack();

            String pushed1 = null;
            String pushed2 = "";
            String pushed3 = "three";
            stack.Push(pushed1);
            stack.Push(pushed2);
            stack.Push(pushed3);

            int expected = 3;
            int actual = stack.Count();

            Assert.AreEqual(expected, actual, "Number of items pushed does not equal number of items counted");
        }
Exemplo n.º 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");
        }
Exemplo n.º 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");
        }
Exemplo n.º 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");
        }
Exemplo n.º 5
0
        public void PushPop_ReturnsPushValue()
        {
            Stack stack = new Stack();

            String pushed = "one";
            stack.Push(pushed);
            String popped = stack.Pop();

            Assert.AreEqual(pushed, popped, "Popped value does not equal pushed value");
        }
Exemplo n.º 6
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");
        }
Exemplo n.º 7
0
        public void PushPopCount_ReturnsZero()
        {
            Stack stack = new Stack();

            String pushed1 = "one";

            stack.Push(pushed1);
            stack.Pop();

            int expected = 0;
            int actual = stack.Count();

            Assert.AreEqual(expected, actual, "Popped stack not empty");
        }
Exemplo n.º 8
0
        public void PushPeek_ReturnsPushValue()
        {
            Stack stack = new Stack();

            String pushed = "one";
            stack.Push(pushed);
            String peeked = stack.Peek();

            Assert.AreEqual(pushed, peeked, "Pushed value does not equal peeked value");
        }