Exemple #1
0
        public void SizeOnFullSet()
        {
            var queue = new BoundedFifoQueue <int>();

            queue.Enqueue(4);

            Assert.That(() => queue.Size(), Is.EqualTo(1));
        }
Exemple #2
0
        public void IsEmptyOnFullSet()
        {
            var queue = new BoundedFifoQueue <int>();

            queue.Enqueue(4);

            Assert.That(() => queue.IsEmpty(), Is.False);
        }
Exemple #3
0
        public void CanAssignThreshold(int threshold)
        {
            var queue = new BoundedFifoQueue <int>(threshold);

            for (var i = 0; i < threshold; i++)
            {
                queue.Enqueue(i);
            }

            Assert.That(() => queue.Enqueue(4), Throws.InstanceOf <IndexOutOfRangeException>());
        }
Exemple #4
0
        public void DefaultThresholdIs10()
        {
            var queue = new BoundedFifoQueue <int>();

            queue.Enqueue(4);
            queue.Enqueue(4);
            queue.Enqueue(4);
            queue.Enqueue(4);
            queue.Enqueue(4);
            queue.Enqueue(4);
            queue.Enqueue(4);
            queue.Enqueue(4);
            queue.Enqueue(4);
            queue.Enqueue(4);


            Assert.That(() => queue.Enqueue(4), Throws.InstanceOf <IndexOutOfRangeException>());
        }
Exemple #5
0
        public void SizeOnEmptySet()
        {
            var queue = new BoundedFifoQueue <int>();

            Assert.That(() => queue.Size(), Is.EqualTo(0));
        }
Exemple #6
0
        public void DequeueOnEmptySet()
        {
            var queue = new BoundedFifoQueue <int>();

            Assert.That(() => queue.Dequeue(), Throws.InstanceOf <ArgumentOutOfRangeException>());
        }
Exemple #7
0
        public void IsEmptyOnEmptySet()
        {
            var queue = new BoundedFifoQueue <int>();

            Assert.That(() => queue.IsEmpty(), Is.True);
        }