本文整理汇总了C#中Microsoft.OData.Edm.Library.EdmComplexType.FindProperty方法的典型用法代码示例。如果您正苦于以下问题:C# EdmComplexType.FindProperty方法的具体用法?C# EdmComplexType.FindProperty怎么用?C# EdmComplexType.FindProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.OData.Edm.Library.EdmComplexType
的用法示例。
在下文中一共展示了EdmComplexType.FindProperty方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Exception_From_Compute_Does_Not_Make_Cache_To_Fail_With_NullRefException
public void Exception_From_Compute_Does_Not_Make_Cache_To_Fail_With_NullRefException()
{
var complexType = new EdmComplexType("Bar", "Foo");
var property = new StubEdmStructuralProperty(null) { DeclaringType = complexType };
complexType.AddProperty(property);
for (int i = 0; i < 10; i++)
{
try
{
complexType.FindProperty(null);
}
catch (ArgumentNullException) { }
}
}
示例2: AmbiguousPropertyTest
public void AmbiguousPropertyTest()
{
EdmComplexType complex = new EdmComplexType("Bar", "Foo");
StubEdmStructuralProperty prop1 = new StubEdmStructuralProperty("Foo");
StubEdmStructuralProperty prop2 = new StubEdmStructuralProperty("Foo");
StubEdmStructuralProperty prop3 = new StubEdmStructuralProperty("Foo");
prop1.DeclaringType = complex;
prop2.DeclaringType = complex;
prop3.DeclaringType = complex;
complex.AddProperty(prop1);
complex.AddProperty(prop2);
complex.AddProperty(prop3);
IEdmProperty ambiguous = complex.FindProperty("Foo");
Assert.IsTrue(ambiguous.IsBad(), "Ambiguous binding is bad");
Assert.AreEqual(EdmPropertyKind.None, ambiguous.PropertyKind, "No property kind.");
Assert.AreEqual(complex, ambiguous.DeclaringType, "Correct declaring type.");
Assert.IsTrue(ambiguous.Type.IsBad(), "Type is bad.");
complex = new EdmComplexType("Bar", "Foo");
prop3 = new StubEdmStructuralProperty("Foo");
prop3.DeclaringType = complex;
complex.AddProperty(prop3);
Assert.AreEqual(prop3, complex.FindProperty("Foo"), "Correct last item remaining.");
}