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

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

            Assert.IsFalse(circularQueue.IsReadOnly);

            circularQueue = CircularQueueTest.GetFullTestQueue();
            Assert.IsFalse(circularQueue.IsReadOnly);
        }
示例#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));
        }
示例#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));
            }
        }
示例#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);
        }
示例#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));
            }
        }
示例#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));
            }
        }