public void TestOverriddenExtensionInfo() { ExtensionInfo info = new ExtensionInfo <TestDomNodeType>("foo"); DomNodeType test = new DomNodeType( "test", null, EmptyEnumerable <AttributeInfo> .Instance, EmptyEnumerable <ChildInfo> .Instance, new ExtensionInfo[] { info }); ExtensionInfo overridden = new ExtensionInfo <TestDomNodeType>("foo"); DomNodeType child = new DomNodeType("child", test, EmptyEnumerable <AttributeInfo> .Instance, EmptyEnumerable <ChildInfo> .Instance, new ExtensionInfo[] { overridden }); Assert.AreSame(child.GetExtensionInfo("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)); }
public void TestInheritedExtensionInfo() { ExtensionInfo info = new ExtensionInfo <TestDomNodeType>("foo"); DomNodeType test = new DomNodeType( "test", null, EmptyEnumerable <AttributeInfo> .Instance, EmptyEnumerable <ChildInfo> .Instance, new ExtensionInfo[] { info }); DomNodeType child = new DomNodeType("child"); child.BaseType = test; ExtensionInfo inherited = child.GetExtensionInfo("foo"); Assert.AreEqual(inherited.OwningType, test); Assert.AreEqual(inherited.DefiningType, test); Assert.True(inherited.Equivalent(info)); Assert.True(info.Equivalent(inherited)); }