Ejemplo n.º 1
0
        public void popEmptyList()
        {
            Problem2 p2 = new Problem2();
             Object expected = null;

             Object actual = p2.Pop();

             Assert.AreEqual(expected, actual, "Wrong output from popping empty list");
        }
Ejemplo n.º 2
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");
        }
Ejemplo n.º 3
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");
        }
Ejemplo n.º 4
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");
        }
Ejemplo n.º 5
0
        public void peekEmptyList()
        {
            //arange
             Problem2 p2 = new Problem2();
             Object expected = null;

             //act
             Object actual = p2.Peek();

             //assert
             Assert.AreEqual(expected, actual, "Wrong output from peeking empty list");
        }
Ejemplo n.º 6
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");
        }
Ejemplo n.º 7
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");
        }
Ejemplo n.º 8
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");
        }