Ejemplo n.º 1
0
        public void SimpleTagName()
        {
            // form(label, button, panel(label, button))

            var form    = new MyNode("form", true);
            var label1  = new MyNode("label", true);
            var button1 = new MyNode("button", true);
            var panel   = new MyNode("panel", true);
            var label2  = new MyNode("label", true);
            var button2 = new MyNode("button", false);

            form.AddChild(label1);
            form.AddChild(button1);
            form.AddChild(panel);
            panel.AddChild(label2);
            panel.AddChild(button2);

            var ops = new MyNodeOps();

            var eval = new Evaluator <MyNode>(ops);
            {
                var list = eval.Evaluate("button", form).ToList();
                Assert.AreEqual(2, list.Count);
                Assert.IsTrue(list.Any(e => e == button1));
                Assert.IsTrue(list.Any(e => e == button2));
            }
            {
                var list = eval.Evaluate("button[enabled=\"false\"]", form).ToList();
                Assert.AreEqual(1, list.Count);
                Assert.IsTrue(button2 == list[0]);
            }
        }
Ejemplo n.º 2
0
        public void SuccessorTests()
        {
            var A = new MyNode("A", true);
            var B = new MyNode("B", true);
            var C = new MyNode("C", true);
            var D = new MyNode("D", true);
            var E = new MyNode("E", true);
            var F = new MyNode("F", true);

            A.AddChild(B);
            A.AddChild(C);
            B.AddChild(D);
            B.AddChild(E);
            E.AddChild(F);

            var ops = new MyNodeOps();

            Assert.AreEqual(F, ops.Successor(D));
            Assert.AreEqual(C, ops.Successor(F));
            Assert.AreEqual(null, ops.Successor(C));
        }