Beispiel #1
0
        public void Count_ofAStackWith1Item_Returns1()
        {
            Stack testStack = new Stack();

            testStack.push("this is a testString");

            int oneCount = 1;

            int result = testStack.Count();

            Assert.AreEqual(oneCount, result);
        }
Beispiel #2
0
        public void Count_ofAnEmptyStack_Returns0()
        {
            Stack testStack;

            testStack = new Stack();

            int zeroCount = 0;

            int result = testStack.Count();

            Assert.AreEqual(zeroCount, result);
        }
Beispiel #3
0
        public void Count_ofAStackWith1ItemAfterPeek_Returns1()
        {
            Stack testStack = new Stack();

            testStack.push("this is a testString 1");

            int oneCount = 1;

            int CountResult = testStack.Count();

            string stringFromPeek = testStack.Peek();

            Assert.AreEqual(oneCount, CountResult);
        }
Beispiel #4
0
        public void Count_ofAStackWith4Item_Returns4()
        {
            Stack testStack = new Stack();

            testStack.push("this is a testString 1");
            testStack.push("this is a testString 2");
            testStack.push("this is a testString 3");
            testStack.push("this is a testString 4");

            int oneCount = 4;

            int result = testStack.Count();

            Assert.AreEqual(oneCount, result);
        }
Beispiel #5
0
        public void PopString_ofAStackWith3ItemsPopTo0_CountReturn0()
        {
            Stack testStack = new Stack();

            string testString = "this is a testString 1";
            string testString2 = "this is the 2nd test String";
            string testString3 = "this is the 3rd test String";

            testStack.push(testString);
            testStack.push(testString2);
            testStack.push(testString3);

            testStack.Pop();
            testStack.Pop();
            testStack.Pop();

            int popCount = testStack.Count();
            int expectPopcount = 0;

            Assert.AreEqual(popCount, expectPopcount);
        }