示例#1
0
        public void isEmpty_ofAStackWith3ItemsPopTo0_isEmptyTrue()
        {
            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();

            bool result = testStack.isEmpty();

            Assert.IsTrue(result);
        }
示例#2
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);
        }
示例#3
0
        public void PopAllString_ofAStackWith3ItemAfterPop_returnexception()
        {
            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();
             testStack.Pop();
        }
示例#4
0
        public void PopString_ofAStackWith3ItemAfterPop_PopreturnslastString()
        {
            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);

            string stringFromPop = testStack.Pop();

            Assert.AreEqual(stringFromPop, testString3);
        }
示例#5
0
        public void Peekstring_ofAStackWith3ItemAfterPeekPopedToFirst_ReturnslastPeekString()
        {
            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();

            string stringFromPeek = testStack.Peek();

            Assert.AreEqual(stringFromPeek, testString);
        }