Esempio n. 1
0
        public void EnqueOneAfterEmptying()
        {
            const int first = 1;
            const int second = 2;
            var queue = new QueueWithTwoStacks();

            queue.Enqueue(first);
            queue.Dequeue();

            queue.Enqueue(second);

            var result = queue.Dequeue();
            Assert.IsNotNull(result);
            Assert.AreEqual(second, result);
        }
Esempio n. 2
0
        public void DequeWhenEmpty()
        {
            var queue = new QueueWithTwoStacks();

            var result = queue.Dequeue();
            Assert.IsNull(result);
        }
Esempio n. 3
0
        public void EnqueMultiple()
        {
            const int first = 1;
            const int second = 2;
            var queue = new QueueWithTwoStacks();

            queue.Enqueue(first);
            queue.Enqueue(second);

            var resultFirst = queue.Dequeue();
            Assert.IsNotNull(resultFirst);
            Assert.AreEqual(first, resultFirst);

            var resultSecond = queue.Dequeue();
            Assert.IsNotNull(resultSecond);
            Assert.AreEqual(second, resultSecond);
        }
Esempio n. 4
0
        public void EnqueMultipleAfterEmptying()
        {
            const int first = 1;
            const int second = 2;
            const int third = 3;
            var queue = new QueueWithTwoStacks();

            queue.Enqueue(first);
            queue.Dequeue();

            queue.Enqueue(second);
            queue.Enqueue(third);

            var resultSecond = queue.Dequeue();
            Assert.IsNotNull(resultSecond);
            Assert.AreEqual(second, resultSecond);

            var resultThird = queue.Dequeue();
            Assert.IsNotNull(resultThird);
            Assert.AreEqual(third, resultThird);
        }
Esempio n. 5
0
        public void EnqueOneWhenEmpty()
        {
            const int value = 1;
            var queue = new QueueWithTwoStacks();

            queue.Enqueue(value);

            var result = queue.Dequeue();
            Assert.IsNotNull(result);
            Assert.AreEqual(value, result);
        }