Esempio n. 1
0
        public void IsEmpty_ReturnsTrue()
        {
            var queue = new DynamicQueue<int>();
            var result = queue.IsEmpty();

            Assert.IsTrue(result == true);
        }
Esempio n. 2
0
        public void IsEmpty_ReturnsFalse()
        {
            var queue = new DynamicQueue<int>();
            queue.Enqueue(29);
            var result = queue.IsEmpty();

            Assert.IsTrue(result == false);
        }
Esempio n. 3
0
        public void Dequeue_ReturnsItems()
        {
            var queue = new DynamicQueue<int>();

            queue.Enqueue(10);
            queue.Enqueue(100);
            queue.Enqueue(200);

            //should be three items in the queue
            Assert.IsTrue(queue.CurrentSize == 3);

            var item = queue.Dequeue();

            //dequeued item should be 10
            Assert.IsTrue(item ==  10);

            //items in the queue should be 2
            Assert.IsTrue(queue.CurrentSize == 2);

            item = queue.Dequeue();

            //dequeued item should be 100
            Assert.IsTrue(item == 100);

            //items in the queue should be 1
            Assert.IsTrue(queue.CurrentSize == 1);

            item = queue.Dequeue();

            //dequeued item should be 200
            Assert.IsTrue(item == 200);

            //items in the queue should be 0 and queue is empty
            Assert.IsTrue(queue.CurrentSize ==0);
            Assert.IsTrue(queue.IsEmpty() == true);


        }