Пример #1
0
        public void PopTestSuccess()
        {
            var s = new CStack(10);
            s.Push(11);

            Assert.AreEqual(1, s.Size);

            int popRtrn = s.Pop();
            Assert.AreEqual(11, popRtrn);
            Assert.AreEqual(0, s.Size);
        }
Пример #2
0
        public void MultiplePushTestErrorIndexOutOfRangeException()
        {
            var x = new CStack(4);

            x.Push(10);
            Assert.AreEqual(10, x.Top());
            Assert.AreEqual(1, x.Size);

            x.Push(20);
            Assert.AreEqual(20, x.Top());
            Assert.AreEqual(2, x.Size);

            x.Push(30);
            Assert.AreEqual(30, x.Top());
            Assert.AreEqual(3, x.Size);

            x.Push(40);
            Assert.AreEqual(40, x.Top());
            Assert.AreEqual(4, x.Size);

            x.Push(50);
        }
Пример #3
0
        public void MultiplePushTestSuccess()
        {
            var x = new CStack(5);

            x.Push(10);
            Assert.AreEqual(10, x.Top());
            Assert.AreEqual(1, x.Size);

            x.Push(20);
            Assert.AreEqual(20, x.Top());
            Assert.AreEqual(2, x.Size);

            x.Push(30);
            Assert.AreEqual(30, x.Top());
            Assert.AreEqual(3, x.Size);

            x.Push(40);
            Assert.AreEqual(40, x.Top());
            Assert.AreEqual(4, x.Size);

            x.Push(-50);
            Assert.AreEqual(-50, x.Top());
            Assert.AreEqual(5, x.Size);
        }
Пример #4
0
 public void PushTestSuccess()
 {
     var s = new CStack(10);
     s.Push(10);
     Assert.AreEqual(1, s.Size);
 }
Пример #5
0
 public void PushTestErrorIndexOutOfRangeException()
 {
     var s = new CStack(0);
     s.Push(10);
 }
Пример #6
0
 public void PopTestErrorInvalidOperationException()
 {
     var s = new CStack(10);
     int popRtrn = s.Pop();
 }
Пример #7
0
        public void TopTestSuccess()
        {
            var s = new CStack(10);
            s.Push(19);

            Assert.AreEqual(19, s.Top());
            Assert.AreEqual(1, s.Size);
        }
Пример #8
0
 public void TopTestErrorInvalidOperationException()
 {
     var s = new CStack(10);
     s.Top();
 }