Esempio n. 1
0
        public void EnqueueTwoItemsDequeuBottomItem()
        {
            var queue = new QueueAsList <string>();

            queue.Enqueue("test");
            queue.Enqueue("other test");
            Assert.AreEqual("test", queue.Dequeue());
        }
Esempio n. 2
0
        public void EnqueueTwoItemsCountIs2()
        {
            var queue = new QueueAsList <string>();

            queue.Enqueue("test");
            queue.Enqueue("other test");
            Assert.AreEqual(2, queue.Count);
        }
Esempio n. 3
0
        public void EnqueueTwoItemsDequeueRemainsSecond()
        {
            var queue = new QueueAsList <string>();

            queue.Enqueue("test");
            queue.Enqueue("other test");
            queue.Dequeue();
            Assert.AreEqual(1, queue.Count);
            Assert.AreEqual("other test", queue.Dequeue());
        }
Esempio n. 4
0
        public void EnqueueItemCanDequeueItem()
        {
            var queue = new QueueAsList <string>();

            queue.Enqueue("test");
            Assert.AreEqual("test", queue.Dequeue());
        }
Esempio n. 5
0
        public void EnqueueItemCountIs1()
        {
            var queue = new QueueAsList <string>();

            queue.Enqueue("test");
            Assert.AreEqual(1, queue.Count);
        }
Esempio n. 6
0
        public void ClearQueueCantDequeueItem()
        {
            var queue = new QueueAsList <string>();

            queue.Enqueue("test");
            queue.Clear();
            queue.Dequeue();
        }
Esempio n. 7
0
        public void ClearQueueResetsCountTo0()
        {
            var queue = new QueueAsList <string>();

            queue.Enqueue("test");
            queue.Clear();
            Assert.AreEqual(0, queue.Count);
        }
Esempio n. 8
0
        public void QueueOneItemCanIterate()
        {
            var queue = new QueueAsList <string>();

            queue.Enqueue("test");
            foreach (var item in queue)
            {
                Assert.AreEqual("test", item);
            }
        }
Esempio n. 9
0
        public void QueueAddFiveItemsIterateInOrder()
        {
            var queue = new QueueAsList <int>();

            for (int i = 0; i < 5; i++)
            {
                queue.Enqueue(i);
            }
            var num = 0;

            foreach (var item in queue)
            {
                Assert.AreEqual(num, item);
                num++;
            }
        }