示例#1
0
        public void TestOverriddenChildInfo()
        {
            DomNodeType childType = new DomNodeType("foo");
            ChildInfo   info      = new ChildInfo("foo", childType);
            DomNodeType test      = new DomNodeType(
                "test",
                null,
                EmptyEnumerable <AttributeInfo> .Instance,
                new ChildInfo[] { info },
                EmptyEnumerable <ExtensionInfo> .Instance);

            ChildInfo   overridden = new ChildInfo("foo", childType);
            DomNodeType child      = new DomNodeType("child", test,
                                                     EmptyEnumerable <AttributeInfo> .Instance,
                                                     new ChildInfo[] { overridden },
                                                     EmptyEnumerable <ExtensionInfo> .Instance);

            Assert.AreSame(child.GetChildInfo("foo"), overridden);
            Assert.AreEqual(overridden.OwningType, child);
            Assert.AreEqual(overridden.DefiningType, test);

            Assert.True(info.Equivalent(overridden));
            Assert.True(overridden.Equivalent(info));

            Assert.True(test.IsValid(overridden));
            Assert.True(child.IsValid(info));
        }
示例#2
0
        public void TestInheritedChildInfo()
        {
            ChildInfo   info = new ChildInfo("foo", new DomNodeType("foo"));
            DomNodeType test = new DomNodeType(
                "test",
                null,
                EmptyEnumerable <AttributeInfo> .Instance,
                new ChildInfo[] { info },
                EmptyEnumerable <ExtensionInfo> .Instance);

            DomNodeType child = new DomNodeType("child");

            child.BaseType = test;

            ChildInfo inherited = child.GetChildInfo("foo");

            Assert.AreEqual(inherited.OwningType, test);
            Assert.AreEqual(inherited.DefiningType, test);

            Assert.True(inherited.Equivalent(info));
            Assert.True(info.Equivalent(inherited));
        }