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 Overrun() { var circularQueue = CircularQueueTest.GetOverrunTestQueue(); for (var i = 60; i < 100; i++) { Assert.IsTrue(circularQueue.Contains(i)); } Assert.IsFalse(circularQueue.Contains(400)); Assert.IsFalse(circularQueue.Contains(40)); }
public void HalfFull() { var circularQueue = CircularQueueTest.GetHalfFullTestQueue(); 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 Overrun() { var circularQueue = CircularQueueTest.GetOverrunTestQueue(); var visitor = new TrackingVisitor <int>(); circularQueue.AcceptVisitor(visitor); var list = new List <int>(visitor.TrackingList); Assert.AreEqual(list.Count, 40); for (var i = 60; i < 100; i++) { Assert.IsTrue(list.Contains(i)); } }
public void HalfFull() { var circularQueue = CircularQueueTest.GetHalfFullTestQueue(); 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 Overrun() { var circularQueue = CircularQueueTest.GetOverrunTestQueue(); var array = new int[40]; circularQueue.CopyTo(array, 0); var counter = 0; for (var i = 60; i < 100; i++) { Assert.AreEqual(array[counter], i); counter++; } }
public void HalfFull() { var circularQueue = CircularQueueTest.GetHalfFullTestQueue(); 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 Overrun() { var circularQueue = CircularQueueTest.GetOverrunTestQueue(); 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)); } }
public void HalfFull() { var circularQueue = CircularQueueTest.GetHalfFullTestQueue(); var array = new int[200]; circularQueue.CopyTo(array, 0); var counter = 0; for (var i = 100; i < 200; i++) { Assert.AreEqual(array[counter], i); counter++; } for (var i = 0; i < 100; i++) { Assert.AreEqual(array[counter], i); counter++; } }