public BaseElementWalker(BaseWalkerFactory _theFactory) : base(_theFactory) { string name = this.GetType().Name; constructWalkers(name + "+Walk"); }
public virtual void testDepth() { BaseWalkerFactory bf = new BaseWalkerFactory(); BaseWalker b = new TestWalker(bf); Assert.AreEqual(1, b.getDepth()); }
/// /// * <param name="factory"> </param> /// private void addToFactory(BaseWalkerFactory factory) { System.Type cBase = typeof(BaseWalker); System.Type c = this.GetType().BaseType; // calculate the number of intermediate classes while (cBase.IsAssignableFrom(c)) { c = c.BaseType; depth++; } factory.addWalker(this); }
public virtual void testDepthWalk() { BaseWalkerFactory bf = new BaseWalkerFactory(); new TestWalker(bf); XMLDoc d = new XMLDoc("a", null); ElementWalker ew = new ElementWalker(bf); KElement root = d.getRoot(); Assert.AreEqual(1, ew.walk(root)); for (int i = 1; i <= 10; i++) { root.getCreateXPathElement("b/c/d[" + i + "]"); } Assert.AreEqual(13, ew.walk(root), "a,b,c+10*d=13"); }
/// /// * <param name="factory"> /// * this call adds the testwalker to the factory </param> /// public TestWalker(BaseWalkerFactory factory) : base(factory) { }
/// /// <summary> * </summary> /// * <param name="factory"> </param> /// public BaseWalker(BaseWalkerFactory factory) { depth = 0; addToFactory(factory); }