Esempio n. 1
0
        public void StoppingVisitor()
        {
            var circularQueue = CircularQueueTest.GetFullTestQueue();
            var visitor       = new CompletedTrackingVisitor <int>();

            circularQueue.AcceptVisitor(visitor);
        }
Esempio n. 2
0
        public void Simple()
        {
            var circularQueue = new CircularQueue <int>(40);

            Assert.IsFalse(circularQueue.IsReadOnly);

            circularQueue = CircularQueueTest.GetFullTestQueue();
            Assert.IsFalse(circularQueue.IsReadOnly);
        }
Esempio n. 3
0
        public void Full()
        {
            var circularQueue = CircularQueueTest.GetFullTestQueue();

            for (var i = 100; i < 200; i++)
            {
                Assert.IsTrue(circularQueue.Contains(i));
            }

            for (var i = 0; i < 100; i++)
            {
                Assert.IsTrue(circularQueue.Contains(i));
            }

            Assert.IsFalse(circularQueue.Contains(400));
        }
Esempio n. 4
0
        public void Full()
        {
            var circularQueue = CircularQueueTest.GetFullTestQueue();
            var visitor       = new TrackingVisitor <int>();

            circularQueue.AcceptVisitor(visitor);

            var list = new List <int>(visitor.TrackingList);

            Assert.AreEqual(list.Count, 200);

            for (var i = 0; i < 200; i++)
            {
                Assert.IsTrue(list.Contains(i));
            }
        }
Esempio n. 5
0
        public void Full()
        {
            var circularQueue = CircularQueueTest.GetFullTestQueue();

            circularQueue.Clear();

            Assert.AreEqual(circularQueue.Count, 0);

            circularQueue.Enqueue(4);
            Assert.AreEqual(circularQueue.Count, 1);

            Assert.AreEqual(circularQueue.Dequeue(), 4);
            Assert.AreEqual(circularQueue.Count, 0);

            circularQueue.Clear();
            Assert.AreEqual(circularQueue.Count, 0);
        }
Esempio n. 6
0
        public void Interface()
        {
            IEnumerable circularQueue = CircularQueueTest.GetFullTestQueue();

            var list = new List <int>();

            var enumerator = circularQueue.GetEnumerator();

            while (enumerator.MoveNext())
            {
                list.Add((int)enumerator.Current);
            }

            Assert.AreEqual(list.Count, 200);

            for (var i = 0; i < 200; i++)
            {
                Assert.IsTrue(list.Contains(i));
            }
        }
Esempio n. 7
0
        public void Simple()
        {
            var circularQueue = CircularQueueTest.GetFullTestQueue();

            var list = new List <int>();

            using (var enumerator = circularQueue.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    list.Add(enumerator.Current);
                }
            }

            Assert.AreEqual(list.Count, 200);

            for (var i = 0; i < 200; i++)
            {
                Assert.IsTrue(list.Contains(i));
            }
        }