Пример #1
0
        public void VerifyPeekInQueue()
        {
            var actual = new QueueUsingLinkedList();

            actual.Enqueue(12);
            actual.Enqueue(14);
            actual.Enqueue(16);

            Assert.AreEqual(3, actual.Count());

            var value = actual.Peek();

            Assert.AreEqual(12, value);
            Assert.AreEqual(3, actual.Count());
        }
Пример #2
0
        public void VerifyPushInQueue()
        {
            var actual = new QueueUsingLinkedList();

            actual.Enqueue(12);
            actual.Enqueue(14);
            actual.Enqueue(16);

            Assert.AreEqual(3, actual.Count());
        }
        public void Clear()
        {
            QueueUsingLinkedList <int> queue = new QueueUsingLinkedList <int>();

            queue.Enqueue(10);
            queue.Enqueue(20);
            queue.Enqueue(30);
            queue.Enqueue(40);

            //10 <- 20 <- 30 <- 40

            queue.Dequeue();
            queue.Dequeue();
            queue.Dequeue();
            queue.Dequeue();


            Assert.AreEqual(queue.Count(), 0);
        }