コード例 #1
0
        public void CountNewStack_ReturnsZero()
        {
            Stack stack = new Stack();

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

            Assert.AreEqual(expected, actual, "Count of new stack does not equal 0");
        }
コード例 #2
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");
        }
コード例 #3
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");
        }