本文整理汇总了C#中DomNodeType.IsValid方法的典型用法代码示例。如果您正苦于以下问题:C# DomNodeType.IsValid方法的具体用法?C# DomNodeType.IsValid怎么用?C# DomNodeType.IsValid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DomNodeType
的用法示例。
在下文中一共展示了DomNodeType.IsValid方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestCustomAttributeInfo
public void TestCustomAttributeInfo()
{
AttributeInfo info = new AttributeInfo("foo", new AttributeType("foo", typeof(string)));
DomNodeType test = new DomNodeType(
"test",
null,
new AttributeInfo[] { info },
EmptyEnumerable<ChildInfo>.Instance,
EmptyEnumerable<ExtensionInfo>.Instance);
Utilities.TestSequenceEqual(test.Attributes, info);
Assert.True(test.IsValid(info));
Assert.AreSame(test.GetAttributeInfo("foo"), info);
// check that type is now frozen
Assert.Throws<InvalidOperationException>(delegate { test.Define(GetStringAttribute("notFoo")); });
Assert.AreEqual(info.OwningType, test);
Assert.AreEqual(info.DefiningType, test);
Assert.Null(test.GetAttributeInfo("bar"));
}
示例2: TestOverriddenExtensionInfo
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));
}