Пример #1
0
        // throws jjtraveler.VisitFailure
        public virtual void testStopDownUp()
        {
            Identity downId = new Identity();
            Identity upId = new Identity();
            Identity stopId = new Identity();

            Logger expected = new Logger();
            expected.log( new Event(downId, n4) );
            expected.log( new Event(stopId, n4) );
            expected.log( new Event(upId, n4) );

            IVisitor  visitor = new DownUp(
                logVisitor(downId), logVisitor(stopId), logVisitor(upId) );

            IVisitable nodeReturned = visitor.visit(n4);
            Assertion.AssertEquals(expected, logger);
            Assertion.AssertEquals(n4, nodeReturned);
        }
Пример #2
0
        // throws jjtraveler.VisitFailure
        public virtual void testDownUp()
        {
            Identity id = new Identity();
            Logger expected = new Logger(id,
                new IVisitable[]{n4, n3, n0, n0, n1, n1, n3, n2, n2, n4 } );

            IVisitor visitor = new DownUp( logVisitor(id), logVisitor(id) );

            IVisitable nodeReturned = visitor.visit(n4);
            Assertion.AssertEquals(expected, logger);
            Assertion.AssertEquals(n4, nodeReturned);
        }
Пример #3
0
        // throws jjtraveler.VisitFailure
        public virtual void testNonStopDownUp()
        {
            Identity downId = new Identity();
            Identity upId = new Identity();
            Fail stop = new Fail();

            Logger expected = new Logger();
            expected.log( new Event(downId, n3) );
            expected.log( new Event(downId, n0) );
            expected.log( new Event(upId, n0) );
            expected.log( new Event(downId, n1) );
            expected.log( new Event(upId, n1) );
            expected.log( new Event(upId, n3) );

            IVisitor  visitor = new DownUp(
                logVisitor(downId), stop, logVisitor(upId) );

            IVisitable nodeReturned = visitor.visit(n3);
            Assertion.AssertEquals(expected, logger);
            Assertion.AssertEquals(n3, nodeReturned);
        }