示例#1
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);
        }
示例#2
0
        public void Peekstring_ofAStackWith1ItemAfterPeek_ReturnsPeekString()
        {
            Stack testStack = new Stack();

            string testString = "this is a testString 1";

            testStack.push(testString);

            string stringFromPeek = testStack.Peek();

            Assert.AreEqual(stringFromPeek, testString);
        }
示例#3
0
        public void Peekstring_ofAStackWith3ItemAfterPeek_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.Peek();

            string stringFromPeek = testStack.Peek();

            Assert.AreEqual(stringFromPeek, testString3);
        }
示例#4
0
        public void Peekstring_ofAStackWith0ItemAfterPeek_ThrowsExcption()
        {
            Stack testStack = new Stack();

            testStack.Peek();
        }