示例#1
0
        public void CompletedVisitor()
        {
            var pascalSet = new PascalSet(0, 50, new[] { 15, 20, 30, 40, 34 });

            var completedTrackingVisitor = new CompletedTrackingVisitor <int>();

            pascalSet.AcceptVisitor(completedTrackingVisitor);
        }
示例#2
0
        public void CompletedVisitor()
        {
            var pascalSet = new PascalSet(0, 50, new[] { 15, 20, 30, 40, 34 });

            var completedTrackingVisitor = new CompletedTrackingVisitor<int>();

            pascalSet.AcceptVisitor(completedTrackingVisitor);
        }
示例#3
0
        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));
        }
示例#4
0
        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));
        }
示例#5
0
        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);
        }
示例#6
0
        public void ExceptionNullVisitor()
        {
            var pascalSet = new PascalSet(10);

            pascalSet.AcceptVisitor(null);
        }
示例#7
0
 public void ExceptionNullVisitor()
 {
     var pascalSet = new PascalSet(10);
     pascalSet.AcceptVisitor(null);
 }
示例#8
0
        public void ExceptionNullVisitor()
        {
            var pascalSet = new PascalSet(10);

            Assert.Throws <ArgumentNullException>(() => pascalSet.AcceptVisitor(null));
        }