예제 #1
0
        public void QueueChained_EnqueueLimit_AfterLimit()
        {
            // Arrange

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

            // Act

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

            // Assert

            Assert.AreEqual(4, myQueue.GetQueue()[2]);
            Assert.AreEqual(64, myQueue.GetQueue()[3]);
            Assert.AreEqual(21, myQueue.GetQueue()[4]);
            Assert.AreEqual(5, myQueue.GetQueue()[0]);
            Assert.AreEqual(6, myQueue.GetQueue()[1]);
        }
예제 #2
0
        public void QueueChained_DequeuesCorrectly_BeforeLimit()
        {
            // Arrange

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

            // Act

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

            // Assert

            Assert.AreEqual(0, myQueue.GetQueue()[0]);
        }