Пример #1
0
        public void Simple()
        {
            var visitableList = ListTest.GetTestList();
            var visitor       = new SumVisitor();

            visitableList.AcceptVisitor(visitor);

            Assert.AreEqual(visitor.Sum, 0 + 3 + 6 + 9 + 12);
        }
Пример #2
0
        public void Simple()
        {
            var listBase = new ListBase <int>();

            Assert.IsFalse(listBase.IsFixedSize);

            listBase = ListTest.GetTestList();
            Assert.IsFalse(listBase.IsFixedSize);
        }
Пример #3
0
        public void StoppingVisitor()
        {
            var visitableList = ListTest.GetTestList();

            var visitor = new ComparableFindingVisitor <int>(6);

            visitableList.AcceptVisitor(visitor);

            Assert.IsTrue(visitor.Found);

            visitor = new ComparableFindingVisitor <int>(99);
            visitableList.AcceptVisitor(visitor);
            Assert.IsFalse(visitor.Found);
        }