Exemplo n.º 1
0
        public void Test()
        {
            MyQueue obj = new MyQueue();

            obj.Push(1);
            obj.Push(2);
            obj.Push(3);
            Console.WriteLine(obj.Pop());
            Console.WriteLine(obj.Pop());
            Console.WriteLine(obj.Pop());
        }
Exemplo n.º 2
0
            public void Test1()
            {
                // Arrange
                var myQueue = new MyQueue();

                myQueue.Push(1);
                myQueue.Push(2);

                // Act
                // Assert
                Assert.AreEqual(1, myQueue.Peek());
                Assert.AreEqual(1, myQueue.Pop());
                Assert.False(myQueue.Empty());
            }
Exemplo n.º 3
0
        private static void Main()
        {
            var s = new MyStack();

            s.Push(1);
            s.Push(2);
            var top = s.Pop();

            top = s.Top();
            var sEmpty = s.Empty();
            var q      = new MyQueue();

            q.Push(1);
            q.Push(2);
            var peek = q.Peek();

            peek = q.Pop();
            var empty = q.Empty();
        }