public void CompletedVisitor() { var pascalSet = new PascalSet(0, 50, new[] { 15, 20, 30, 40, 34 }); var completedTrackingVisitor = new CompletedTrackingVisitor <int>(); pascalSet.AcceptVisitor(completedTrackingVisitor); }
public void CompletedVisitor() { var pascalSet = new PascalSet(0, 50, new[] { 15, 20, 30, 40, 34 }); var completedTrackingVisitor = new CompletedTrackingVisitor<int>(); pascalSet.AcceptVisitor(completedTrackingVisitor); }
public void Simple() { var pascalSet = new PascalSet(0, 50, new[] { 15, 20, 30, 40, 34 }); var trackingVisitor = new TrackingVisitor <int>(); pascalSet.AcceptVisitor(trackingVisitor); Assert.AreEqual(trackingVisitor.TrackingList.Count, 5); Assert.IsTrue(trackingVisitor.TrackingList.Contains(15)); Assert.IsTrue(trackingVisitor.TrackingList.Contains(20)); Assert.IsTrue(trackingVisitor.TrackingList.Contains(30)); Assert.IsTrue(trackingVisitor.TrackingList.Contains(40)); Assert.IsTrue(trackingVisitor.TrackingList.Contains(34)); }
public void Simple() { var pascalSet = new PascalSet(0, 50, new[] { 15, 20, 30, 40, 34 }); var trackingVisitor = new TrackingVisitor<int>(); pascalSet.AcceptVisitor(trackingVisitor); Assert.AreEqual(trackingVisitor.TrackingList.Count, 5); Assert.IsTrue(trackingVisitor.TrackingList.Contains(15)); Assert.IsTrue(trackingVisitor.TrackingList.Contains(20)); Assert.IsTrue(trackingVisitor.TrackingList.Contains(30)); Assert.IsTrue(trackingVisitor.TrackingList.Contains(40)); Assert.IsTrue(trackingVisitor.TrackingList.Contains(34)); }
public void AcceptExample() { // Create a sample PascalSet instance var set = new PascalSet(100); // Set a couple of values in the PascalSet for (var i = 0; i < 100; i += 10) { set.Add(i); } // Create a counting visitor that will count the number of // items visited. var visitor = new CountingVisitor <int>(); // Open up the door for the visitor set.AcceptVisitor(visitor); // The visitor will have visited 10 items Assert.AreEqual(visitor.Count, 10); }
public void ExceptionNullVisitor() { var pascalSet = new PascalSet(10); pascalSet.AcceptVisitor(null); }
public void ExceptionNullVisitor() { var pascalSet = new PascalSet(10); Assert.Throws <ArgumentNullException>(() => pascalSet.AcceptVisitor(null)); }