Exemplo n.º 1
0
        public void TestStackPush()
        {
            StackBuild testStack = new StackBuild(new Node(5));

            Assert.Equal(6, testStack.Push(new Node(6)).Value);
            Assert.Equal(7, testStack.Push(new Node(7)).Value);
            Assert.Equal(8, testStack.Push(new Node(8)).Value);
        }
        public void CanEnQueue()
        {
            StackBuild stack = new StackBuild(new Node(5));

            stack.Push(new Node(6));
            stack.Push(new Node(7));
            stack.Push(new Node(8));

            Assert.Equal(9, stack.EnQueue(9));
            Assert.Equal(10, stack.EnQueue(10));
            Assert.Equal(11, stack.EnQueue(11));
        }
        public void CanDeQueue()
        {
            StackBuild stack = new StackBuild(new Node(5));

            stack.Push(new Node(6));
            stack.Push(new Node(7));
            stack.Push(new Node(8));
            stack.Push(new Node(9));
            stack.Push(new Node(10));

            Assert.Equal(5, stack.DeQueue());
            Assert.Equal(6, stack.DeQueue());
            Assert.Equal(7, stack.DeQueue());
        }