public void Empty() { var circularQueue = new CircularQueue <int>(40); var visitor = new TrackingVisitor <int>(); circularQueue.AcceptVisitor(visitor); Assert.AreEqual(visitor.TrackingList.Count, 0); }
public void Empty() { var circularQueue = new CircularQueue<int>(40); var visitor = new TrackingVisitor<int>(); circularQueue.AcceptVisitor(visitor); Assert.AreEqual(visitor.TrackingList.Count, 0); }
public void AcceptVisitorExample() { var circularQueue = new CircularQueue<string>(10); circularQueue.Enqueue("cat"); circularQueue.Enqueue("dog"); circularQueue.Enqueue("canary"); // There should be 3 items in the circularQueue. Assert.AreEqual(3, circularQueue.Count); // Create a visitor that will simply count the items in the circularQueue. var visitor = new CountingVisitor<string>(); // Make circularQueue call IVisitor<T>.Visit on all items contained. circularQueue.AcceptVisitor(visitor); // The counting visitor would have visited 3 items. Assert.AreEqual(3, visitor.Count); }
public void AcceptVisitorExample() { var circularQueue = new CircularQueue <string>(10); circularQueue.Enqueue("cat"); circularQueue.Enqueue("dog"); circularQueue.Enqueue("canary"); // There should be 3 items in the circularQueue. Assert.AreEqual(3, circularQueue.Count); // Create a visitor that will simply count the items in the circularQueue. var visitor = new CountingVisitor <string>(); // Make circularQueue call IVisitor<T>.Visit on all items contained. circularQueue.AcceptVisitor(visitor); // The counting visitor would have visited 3 items. Assert.AreEqual(3, visitor.Count); }
public void ExceptionNullVisitor() { var circularQueue = new CircularQueue <int>(20); Assert.Throws <ArgumentNullException>(() => circularQueue.AcceptVisitor(null)); }
public void ExceptionNullVisitor() { var circularQueue = new CircularQueue<int>(20); circularQueue.AcceptVisitor(null); }
public void ExceptionNullVisitor() { var circularQueue = new CircularQueue <int>(20); circularQueue.AcceptVisitor(null); }