コード例 #1
0
ファイル: UnitTest1.cs プロジェクト: hornoo/IN710hornerb1
        public void isEmpty_ofAnewStack_isEmptyfalse()
        {
            Stack testStack = new Stack();

            bool result = testStack.isEmpty();

            Assert.IsTrue(result);
        }
コード例 #2
0
ファイル: UnitTest1.cs プロジェクト: hornoo/IN710hornerb1
        public void Count_ofAnEmptyStack_Returns0()
        {
            Stack testStack;

            testStack = new Stack();

            int zeroCount = 0;

            int result = testStack.Count();

            Assert.AreEqual(zeroCount, result);
        }
コード例 #3
0
ファイル: UnitTest1.cs プロジェクト: hornoo/IN710hornerb1
        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);
        }
コード例 #4
0
ファイル: UnitTest1.cs プロジェクト: hornoo/IN710hornerb1
        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);
        }
コード例 #5
0
ファイル: UnitTest1.cs プロジェクト: hornoo/IN710hornerb1
        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);
        }
コード例 #6
0
ファイル: UnitTest1.cs プロジェクト: hornoo/IN710hornerb1
        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);
        }
コード例 #7
0
ファイル: UnitTest1.cs プロジェクト: hornoo/IN710hornerb1
        public void ToString_StackTostring3item_string()
        {
            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 toStringString = testStack.ToString();

            string expectedString = "0 this is a testString 1, 1 this is the 2nd test String, 2 this is the 3rd test String, ";

            Assert.AreEqual(expectedString, toStringString);
        }
コード例 #8
0
ファイル: UnitTest1.cs プロジェクト: hornoo/IN710hornerb1
        public void ToString_StackTostring1item_string()
        {
            Stack testStack = new Stack();

            string testString = "this is a testString 1";

            testStack.push(testString);

            string toStringString = testStack.ToString();

            string expectedString = "0 this is a testString 1, ";

            Assert.AreEqual(toStringString, expectedString);
        }
コード例 #9
0
ファイル: UnitTest1.cs プロジェクト: hornoo/IN710hornerb1
        public void ToString_StackTostring0item_string()
        {
            Stack testStack = new Stack();

            string toStringString = testStack.ToString();

            string expectedString = "Stack is empty.";

            Assert.AreEqual(expectedString, toStringString);
        }
コード例 #10
0
ファイル: UnitTest1.cs プロジェクト: hornoo/IN710hornerb1
        public void push_NullStringToStack_throwException()
        {
            Stack testStack = new Stack();

            String testString = null;

            testStack.push(testString);
        }
コード例 #11
0
ファイル: UnitTest1.cs プロジェクト: hornoo/IN710hornerb1
        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);
        }
コード例 #12
0
ファイル: UnitTest1.cs プロジェクト: hornoo/IN710hornerb1
        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);
        }
コード例 #13
0
ファイル: UnitTest1.cs プロジェクト: hornoo/IN710hornerb1
        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();
        }
コード例 #14
0
ファイル: UnitTest1.cs プロジェクト: hornoo/IN710hornerb1
        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);
        }
コード例 #15
0
ファイル: UnitTest1.cs プロジェクト: hornoo/IN710hornerb1
        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);
        }
コード例 #16
0
ファイル: UnitTest1.cs プロジェクト: hornoo/IN710hornerb1
        public void Peekstring_ofAStackWith0ItemAfterPeek_ThrowsExcption()
        {
            Stack testStack = new Stack();

            testStack.Peek();
        }