Exemplo n.º 1
0
        public void QueueChained_DequeueLimit_AfterLimit()
        {
            // Arrange

            QueueChained <int> myQueue = new QueueChained <int>();

            // Act

            myQueue.Enqueue(4);
            myQueue.Enqueue(64);
            myQueue.Enqueue(4);
            myQueue.Enqueue(64);
            myQueue.Enqueue(4);
            myQueue.Dequeue();
            myQueue.Dequeue();
            myQueue.Enqueue(5);
            myQueue.Enqueue(6);
            myQueue.Dequeue();
            myQueue.Dequeue();
            myQueue.Dequeue();
            myQueue.Dequeue();
            myQueue.Dequeue();

            // Assert

            Assert.AreEqual(0, myQueue.GetQueue()[0]);
            Assert.AreEqual(0, myQueue.GetQueue()[1]);
            Assert.AreEqual(0, myQueue.GetQueue()[2]);
            Assert.AreEqual(0, myQueue.GetQueue()[3]);
            Assert.AreEqual(0, myQueue.GetQueue()[4]);
        }
Exemplo n.º 2
0
        public void QueueChained_DequeuesCorrectly_AfterLimit()
        {
            // Arrange

            QueueChained <int> myQueue = new QueueChained <int>();

            // Act

            myQueue.Enqueue(4);
            myQueue.Enqueue(64);
            myQueue.Enqueue(4);
            myQueue.Enqueue(64);
            myQueue.Enqueue(4);
            myQueue.Dequeue();
            myQueue.Dequeue();
            myQueue.Enqueue(5);
            myQueue.Dequeue();
            myQueue.Dequeue();
            myQueue.Dequeue();
            myQueue.Dequeue();

            // Assert

            Assert.AreEqual(0, myQueue.GetQueue()[0]);
        }
Exemplo n.º 3
0
        public void QueueChained_DequeueLimit_BeforeLimit()
        {
            // Arrange

            QueueChained <int> myQueue = new QueueChained <int>();

            // Act

            myQueue.Dequeue();

            // Assert

            Assert.AreEqual(0, myQueue.GetQueue()[0]);
            Assert.AreEqual(0, myQueue.GetQueue()[1]);
            Assert.AreEqual(0, myQueue.GetQueue()[2]);
            Assert.AreEqual(0, myQueue.GetQueue()[3]);
            Assert.AreEqual(0, myQueue.GetQueue()[4]);
        }
Exemplo n.º 4
0
        public void QueueChained_EnqueuesCorrectly_BeforeLimit()
        {
            // Arrange

            QueueChained <int> myQueue = new QueueChained <int>();

            // Act

            myQueue.Enqueue(4);

            // Assert

            Assert.AreEqual(4, myQueue.GetQueue()[0]);
        }
Exemplo n.º 5
0
        public void QueueChained_EnqueueLimit_BeforeLimit()
        {
            // Arrange

            QueueChained <int> myQueue = new QueueChained <int>();

            // Act

            myQueue.Enqueue(4);
            myQueue.Enqueue(64);
            myQueue.Enqueue(45);
            myQueue.Enqueue(641);
            myQueue.Enqueue(21);
            myQueue.Enqueue(7);

            // Assert

            Assert.AreEqual(4, myQueue.GetQueue()[0]);
            Assert.AreEqual(64, myQueue.GetQueue()[1]);
            Assert.AreEqual(45, myQueue.GetQueue()[2]);
            Assert.AreEqual(641, myQueue.GetQueue()[3]);
            Assert.AreEqual(21, myQueue.GetQueue()[4]);
        }