Example #1
0
        public void testQueueAddAValue()
        {
            CustomQueue<Element> customQueue = new CustomQueue<Element>();
            Element e = new Element(1, "A");
            customQueue.Enqueue(e);

            Assert.AreEqual(e.getText(), customQueue.Dequeue().getText());
        }
Example #2
0
        public void testQueueAddMinValue()
        {
            CustomQueue<Element> customQueue = new CustomQueue<Element>();
            Element minElement = new Element(1, "This is min");

            customQueue.Enqueue(new Element(14, "This is not max"));
            customQueue.Enqueue(new Element(5, "This is not max"));
            customQueue.Enqueue(new Element(4, "This is not max"));
            customQueue.Enqueue(minElement);
            customQueue.Enqueue(new Element(2, "This is not max"));
            customQueue.Enqueue(new Element(7, "This is not max"));
            customQueue.Enqueue(new Element(9, "This is not max"));
            Assert.AreEqual(minElement.getText(), customQueue.LowerPriority().getText());
        }
Example #3
0
        public void testQueueAddMaxValue()
        {
            CustomQueue<Element> customQueue = new CustomQueue<Element>();
            Element maxElement = new Element(10, "This is max");
            customQueue.Enqueue(new Element(1, "This is not max"));
            customQueue.Enqueue(new Element(5, "This is not max"));
            customQueue.Enqueue(new Element(4, "This is not max"));
            customQueue.Enqueue(maxElement);
            customQueue.Enqueue(new Element(1, "This is not max"));
            customQueue.Enqueue(new Element(7, "This is not max"));
            customQueue.Enqueue(new Element(9, "This is not max"));

            Assert.AreEqual(maxElement.getText(), customQueue.Dequeue().getText());
        }