Beispiel #1
0
        public void TestEnqueueFunctionality()
        {
            var myQueue = new Queues.Queue <int>();

            for (int i = 1; i <= 10; i++)
            {
                myQueue.Enqueue(i);
            }

            Assert.IsTrue(myQueue.Count > 0);
            Assert.AreEqual(10, myQueue.Count);
        }
Beispiel #2
0
        public void TestDequeueFunctionality()
        {
            var myQueue = new Queues.Queue <int>();

            for (int i = 1; i <= 10; i++)
            {
                myQueue.Enqueue(i);
            }

            Assert.IsTrue(myQueue.Count > 0);
            Assert.AreEqual(10, myQueue.Count);

            // Verify items are dequeued in the correct order
            for (int i = 1; i <= 10; i++)
            {
                int item = myQueue.Dequeue();
                Assert.AreEqual(i, item);
            }
        }