public void EnqueueTest()
            {
                Queue queue = new QueueList();

                queue.Enqueue(5);
                queue.Enqueue(7);
                queue.Enqueue(9);

                List <object> outputQueue = getQueueList(queue);

                Assert.AreEqual(3, outputQueue.Count);
                Assert.AreEqual(5, outputQueue[0]);
                Assert.AreEqual(7, outputQueue[1]);
                Assert.AreEqual(9, outputQueue[2]);

                queue = new QueueList();
                queue.Enqueue("this");
                queue.Enqueue("is");
                queue.Enqueue(1);
                queue.Enqueue("test");

                outputQueue = getQueueList(queue);
                Assert.AreEqual(4, outputQueue.Count);
                Assert.AreEqual("this", outputQueue[0]);
                Assert.AreEqual("is", outputQueue[1]);
                Assert.AreEqual(1, outputQueue[2]);
                Assert.AreEqual("test", outputQueue[3]);
            }
예제 #2
0
        public void test_dequeue_error_max_queue()
        {
            var queue = new QueueList(1);

            queue.Enqueue(1);

            Assert.Throws <InvalidOperationException>(() => queue.Enqueue(2));
        }
예제 #3
0
        public void test_enqueue_two()
        {
            var queue = new QueueList(3);

            queue.Enqueue(1);
            queue.Enqueue(2);

            Assert.AreEqual(2, queue.Count);
        }
예제 #4
0
        public void test_dequeue()
        {
            var queue = new QueueList(3);

            queue.Enqueue(1);
            queue.Enqueue(2);
            queue.Enqueue(3);
            queue.Dequeue();
            var value = queue.Dequeue();

            Assert.AreEqual(1, value);
        }
예제 #5
0
 public void SetTurnQueue()
 {
     foreach (BattleCharacter character in OrderCharsByCurrentSpeed(characterList))
     {
         turnQueue.Enqueue(character);
     }
 }
예제 #6
0
        static void Main(string[] args)
        {
            QueueList <int> queueList = new QueueList <int>();

            queueList.Enqueue(1);
            queueList.Enqueue(2);
            queueList.Enqueue(3);
            queueList.Enqueue(4);
            queueList.Enqueue(5);

            Console.WriteLine(queueList.Dequeue());
            Console.WriteLine(queueList.Dequeue());
            Console.WriteLine(queueList.Dequeue());
            Console.WriteLine(queueList.Dequeue());
            Console.WriteLine(queueList.Dequeue());



            Console.ReadLine();
        }
예제 #7
0
 public void AddBack(PrintJob job)
 {
     QueueList.Enqueue(job);
 }