Пример #1
0
        public void DequeueTest()
        {
            // arrange
            var       queue    = new PriorityQueueLinkedList <int>();
            const int expected = 21;

            // act
            queue.Enqueue(21);
            queue.Enqueue(100);
            queue.Enqueue(3);

            queue.Dequeue();
            var result = queue.Dequeue();

            Assert.AreEqual(expected, result);

            // arrange
            var queue2 = new PriorityQueueBinaryTree <int>();

            // act
            queue2.Enqueue(21);
            queue2.Enqueue(100);
            queue2.Enqueue(3);

            queue2.Dequeue();
            result = queue2.Dequeue();

            Assert.AreEqual(expected, result);
        }
Пример #2
0
        public void DequeueWithNoItemsShouldThrowException()
        {
            // arrange
            var queue = new PriorityQueueLinkedList <int>();

            // act
            queue.Dequeue();

            // arrange
            var queue2 = new PriorityQueueBinaryTree <int>();

            // act
            queue2.Dequeue();
        }