public void Visit_should_dispatch_to_less_specific_slow_derived_interface_method()
        {
            var doc = new DomDocument();
            var ele = doc.AppendElement("ok");

            ele.Append(new RTextDerived());

            var r = new RNodeVisitor();

            DomNodeVisitor.Visit(doc, r);
            Assert.Equal(1, r.VisitTextCallCount); // Because Visit(RTextDerived) does not exist
            Assert.Equal(0, r.VisitDefaultTextCalledCount);
        }
Exemplo n.º 2
0
        public void Visitor_should_dispatch_to_delegate_types()
        {
            var doc = new DomDocument();
            var ele = doc.AppendElement("html");

            ele.AppendElement("body");
            ele.Append(new RElement("name"));

            var rv = new RNodeVisitor();

            rv.Visit(doc);

            // Should delegate to the specialized dispatch and not the default
            Assert.Equal(1, rv.VisitElementCalledCount);
            Assert.Equal(2, rv.VisitDefaultElementCalledCount);
        }