public void CanInitializeWithFirstELm()
        {
            Node            nodeFirst = new Node("first");
            QueueWithStacks queue     = new QueueWithStacks(nodeFirst);

            Assert.Equal(nodeFirst, queue.Peek());
        }
        public void CanEnqueueSecondElm()
        {
            Node            nodeFirst  = new Node("first");
            Node            nodeSecond = new Node("second");
            QueueWithStacks queue      = new QueueWithStacks(nodeFirst);

            queue.Enqueue(nodeSecond);
            Assert.Equal(nodeFirst, queue.Peek());
            Assert.Equal(2, queue.Length);
        }
        public void should_peek_fifo()
        {
            // Arrange
            var queue = new QueueWithStacks <int>();

            queue.Add(42);
            queue.Add(43);

            // Assert
            queue.Peek().Should().Be(42);
        }
Ejemplo n.º 4
0
        public void Peek_bottom_of_queue()
        {
            // Arrange
            QueueWithStacks <int> queue = new QueueWithStacks <int>();

            queue.Enqueue(1);
            queue.Enqueue(2);
            queue.Enqueue(3);
            queue.Enqueue(4);
            queue.Enqueue(5);

            // Assert
            Assert.Equal(1, queue.Peek());
        }