Пример #1
0
        private async Task Descending(PriorityQueueUC <QueuePriority, string> pQueue)
        {
            string dequeued;

            pQueue.TryDequeu(out dequeued);
            Assert.AreEqual("1Higher", dequeued);

            pQueue.TryDequeu(out dequeued);
            Assert.AreEqual("2Higher", dequeued);

            pQueue.TryDequeu(out dequeued);
            Assert.AreEqual("3Higher", dequeued);


            pQueue.TryDequeu(out dequeued);
            Assert.AreEqual("1Normal", dequeued);

            pQueue.TryDequeu(out dequeued);
            Assert.AreEqual("2Normal", dequeued);

            pQueue.TryDequeu(out dequeued);
            Assert.AreEqual("3Normal", dequeued);


            pQueue.TryDequeu(out dequeued);
            Assert.AreEqual("1Lower", dequeued);

            pQueue.TryDequeu(out dequeued);
            Assert.AreEqual("2Lower", dequeued);

            pQueue.TryDequeu(out dequeued);
            Assert.AreEqual("3Lower", dequeued);

            await Task.CompletedTask;
        }
        private void Normal(PriorityQueueUC <QueuePriority, string> pQueue)
        {
            string dequeued;

            pQueue.TryDequeu(out dequeued, QueuePriority.Normal);
            Assert.AreEqual("1Normal", dequeued);

            pQueue.TryDequeu(out dequeued, QueuePriority.Normal);
            Assert.AreEqual("2Normal", dequeued);

            pQueue.TryDequeu(out dequeued, QueuePriority.Normal);
            Assert.AreEqual("3Normal", dequeued);
        }
        private void Lower(PriorityQueueUC <QueuePriority, string> pQueue)
        {
            string dequeued;

            pQueue.TryDequeu(out dequeued, QueuePriority.Lower);
            Assert.AreEqual("1Lower", dequeued);

            pQueue.TryDequeu(out dequeued, QueuePriority.Lower);
            Assert.AreEqual("2Lower", dequeued);

            pQueue.TryDequeu(out dequeued, QueuePriority.Lower);
            Assert.AreEqual("3Lower", dequeued);
        }
        private void Higher(PriorityQueueUC <QueuePriority, string> pQueue)
        {
            string dequeued;

            pQueue.TryDequeu(out dequeued, QueuePriority.Higher);
            Assert.AreEqual("1Higher", dequeued);

            pQueue.TryDequeu(out dequeued, QueuePriority.Higher);
            Assert.AreEqual("2Higher", dequeued);

            pQueue.TryDequeu(out dequeued, QueuePriority.Higher);
            Assert.AreEqual("3Higher", dequeued);
        }