Exemplo n.º 1
0
        public void IsEmpty_FullStack_ReturnsFalse()
        {
            Stack testStack = new Stack();

            testStack.Push("Bob");
            testStack.Push("Fred");

            bool expected = false;

            bool actual = testStack.IsEmpty();

            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 2
0
        public void Count_PushnItems_Returnsn()
        {
            Stack testStack = new Stack();

            testStack.Push("Bob");
            testStack.Push("Fred");

            int expected = 2;

            int actual = testStack.Count();

            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 3
0
        public void IsEmpty_DeleteTest_ReturnTrue()
        {
            Stack testStack = new Stack();
            testStack.Push("Fred");
            testStack.Push("Max");
            testStack.Push("Jim");
            testStack.Push("Tom");
            testStack.Pop();
            testStack.Pop();
            testStack.Pop();
            testStack.Pop();

            bool expected = true;

            bool actual = testStack.IsEmpty();

            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 4
0
        public void Peek_PushItemx_Returnsx()
        {
            Stack testStack = new Stack();

            testStack.Push("Bob");
            testStack.Push("Fred");

            string expected = "Fred";

            string actual = testStack.Peek();

            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 5
0
        public void Pop_DeleteTest_ReturnCountAfterPop()
        {
            Stack testStack = new Stack();
            testStack.Push("Fred");
            testStack.Pop();

            int expected = 0;

            int actual = testStack.Count();

            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 6
0
        public void Peek_PushManyItems_ReturnLastItemPushed()
        {
            Stack testStack = new Stack();
            testStack.Push("Fred");
            testStack.Push("Max");
            testStack.Push("Jim");
            testStack.Push("Tom");

            string expected = "Tom";

            string actual = testStack.Peek();

            Assert.AreEqual(expected, actual);
        }