예제 #1
0
        public void poppingFreesNextValueForPop()
        {
            Problem2 p2 = new Problem2();
             p2.Push(3);
             p2.Push(2);
             p2.Pop();
             Object expected = 3;

             Object actual = p2.Pop();

             Assert.AreEqual(expected, actual, "Wrong output from popping list");
        }
예제 #2
0
        public void duplicateNotPushed()
        {
            Problem2 p2 = new Problem2();
             p2.Push(3);
             p2.Push(2);
             p2.Push(3);
             int expected = 2;

             Object actual = p2.Pop();

             Assert.AreEqual(expected, actual, "Wrong output from pushing duplicate into list");
        }
예제 #3
0
        public void peekValue()
        {
            Problem2 p2 = new Problem2();
             p2.Push(3);
             int expected = 3;

             Object actual = p2.Peek();

             Assert.AreEqual(expected, actual, "Wrong output from peeking list");
        }
예제 #4
0
        public void listEmptyAfterPop()
        {
            Problem2 p2 = new Problem2();
             p2.Push(3);
             Object expected = null;
             p2.Pop();

             Object actual = p2.Pop();

             Assert.AreEqual(expected, actual, "Wrong output from popping empty list");
        }
예제 #5
0
        public void valueStillTopAfterPeek()
        {
            Problem2 p2 = new Problem2();
             p2.Push(3);
             p2.Push(2);
             int expected = 2;

             p2.Peek();
             Object actual = p2.Pop();

             Assert.AreEqual(expected, actual, "Wrong output from popping list after peek");
        }
예제 #6
0
        public void valueCanBeReAddedIfPopped()
        {
            Problem2 p2 = new Problem2();
             p2.Push(3);
             p2.Push(2);
             p2.Pop();
             p2.Push(2);
             Object expected = 2;

             Object actual = p2.Pop();

             Assert.AreEqual(expected, actual, "Wrong output from pushing duplicate after original popped from list");
        }