public void StoppingVisitor() { var circularQueue = CircularQueueTest.GetFullTestQueue(); var visitor = new CompletedTrackingVisitor <int>(); circularQueue.AcceptVisitor(visitor); }
public void Simple() { var circularQueue = new CircularQueue <int>(40); Assert.IsFalse(circularQueue.IsReadOnly); circularQueue = CircularQueueTest.GetFullTestQueue(); Assert.IsFalse(circularQueue.IsReadOnly); }
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)); }
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)); } }
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); }
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)); } }
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)); } }