예제 #1
0
        public void Count_PushSeveralPopAll_ReturnZero()
        {
            Stack target = new Stack();
            //Push several items
            target.Push("a");
            target.Push("b");
            target.Push("c");
            target.Push("d");
            target.Push("e");
            target.Push("f");
            target.Push("g");

            //Pop all items
            target.Pop();
            target.Pop();
            target.Pop();
            target.Pop();
            target.Pop();
            target.Pop();
            target.Pop();

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

            Assert.AreEqual(expected, actual);
        }
예제 #2
0
        public void Count_CalledOnNewStack_ReturnZero()
        {
            Stack target = new Stack();

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

            Assert.AreEqual(expected, actual);
        }
예제 #3
0
        public void Count_PushOneItem_ReturnOne()
        {
            Stack target = new Stack();

            target.Push("a");

            int expected = 1;
            int actual = target.Count();

            Assert.AreEqual(expected, actual);
        }
예제 #4
0
        public void Count_PushSevenItems_ReturnSeven()
        {
            Stack target = new Stack();

            target.Push("a");
            target.Push("b");
            target.Push("c");
            target.Push("d");
            target.Push("e");
            target.Push("f");
            target.Push("g");

            int expected = 7;
            int actual = target.Count();

            Assert.AreEqual(expected,actual);
        }
예제 #5
0
        public void Push_SeveralItemsStackCallCount_ReturnItemCount()
        {
            Stack target = new Stack();

            target.Push("a");
            target.Push("b");
            target.Push("c");
            target.Push("d");

            int expected = 4;
            int actual = target.Count();

            Assert.AreEqual(expected, actual);
        }
예제 #6
0
        public void Pop_PushSeveralItemsPopOneAndCount_ReturnNMinusOne()
        {
            Stack target = new Stack();

            target.Push("a");
            target.Push("b");
            target.Push("c");
            target.Push("d");
            target.Push("e");
            target.Push("f");

            target.Pop();

            int expected = 5;
            int actual = target.Count();

            Assert.AreEqual(expected, actual);
        }
예제 #7
0
        public void Pop_PushOneItemPopCount_ReturnZero()
        {
            Stack target = new Stack();
            String testItem = "My apples are bad";

            target.Push(testItem);
            target.Pop();

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

            Assert.AreEqual(expected, actual);
        }