예제 #1
0
        public void TestClear()
        {
            MySimpleStack S = new MySimpleStack(5);

            S.Push(1);
            S.Push(2);
            S.Push(3);
            S.Clear();
            Assert.AreEqual(0, S.Count());
        }
예제 #2
0
        public void TestPush()
        {
            //Push 3 items, check Count
            MySimpleStack S = new MySimpleStack(5);

            S.Push(1);
            S.Push(2);
            S.Push(3);
            Assert.AreEqual(3, S.Count());
        }
예제 #3
0
        public void TestMethodPush()
        {
            MySimpleStack S = new MySimpleStack(5);

            S.Push(5);
            Assert.AreEqual(1, S.Count);
            S.Push(2);
            S.Push(5);
            Assert.AreEqual(2, S.Count);
        }
예제 #4
0
        public void TestPop()
        {
            //Push some items, check the poped value
            MySimpleStack S = new MySimpleStack(5);

            S.Push(1);
            S.Push(2);
            S.Push(3);
            Assert.AreEqual(3, S.Pop());
            Assert.AreEqual(2, S.Pop());
        }
예제 #5
0
        public void TestPeek()
        {
            //Push some items, check Peeked value and Count
            MySimpleStack S = new MySimpleStack(5);

            S.Push(1);
            S.Push(2);
            S.Push(3);
            S.Peek();
            Assert.AreEqual(3, S.Peek());
            Assert.AreEqual(3, S.Count());
        }