Ejemplo n.º 1
0
        public void Peek_PushTwoItems_ReturnsHeadItem()
        {
            var stack = new MyStack <int>();

            stack.Push(1);
            stack.Push(2);

            Assert.AreEqual(2, stack.Peek());
        }
Ejemplo n.º 2
0
        public void push()
        {
            MyStack <string> stack = new MyStack <string>();

            stack.Push("2");
            string expected = "2";

            Assert.AreEqual(expected, stack.Peek());
        }
Ejemplo n.º 3
0
        public void Peek_PushTwoItemsAndPop_ReturnsHeadElement()
        {
            var stack = new MyStack <int>();

            stack.Push(1);
            stack.Push(2);

            stack.Pop();
            Assert.AreEqual(1, stack.Peek());
        }
Ejemplo n.º 4
0
        public void ERROR1()
        {
            MyStack <string> stack = new MyStack <string>();

            stack.Push("p");
            stack.Push("o");
            stack.Pop();
            stack.Pop();
            stack.Peek();
        }
Ejemplo n.º 5
0
        public void popeek()
        {
            MyStack <string> stack = new MyStack <string>();

            stack.Push("6");
            stack.Push("7");
            stack.Pop();
            string expected = "6";

            Assert.AreEqual(expected, stack.Peek());
        }
Ejemplo n.º 6
0
        public void peek()
        {
            MyStack <string> stack = new MyStack <string>();

            stack.Push("1");
            stack.Push("2");
            stack.Push("3");
            stack.Push("4");
            stack.Push("5");
            //stack.Pop();
            string expected = "5";

            Assert.AreEqual(expected, stack.Peek());
        }