本文整理汇总了C#中TypeWrapper.GetProperty方法的典型用法代码示例。如果您正苦于以下问题:C# TypeWrapper.GetProperty方法的具体用法?C# TypeWrapper.GetProperty怎么用?C# TypeWrapper.GetProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TypeWrapper
的用法示例。
在下文中一共展示了TypeWrapper.GetProperty方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AssertReverseRelationshipNotForOwnerClass
private static void AssertReverseRelationshipNotForOwnerClass(TypeWrapper ownerClassType, TypeWrapper reverseClassType, string reveresRelationshipName)
{
var reversePropInfo = reverseClassType.GetProperty(reveresRelationshipName);
Assert.IsNotNull(reversePropInfo, "No Reverse Relationship found with the name");
Assert.AreNotSame(ownerClassType, reversePropInfo.RelatedClassType);
}
示例2: AssertRelationshipIsForOwnerClass
private static void AssertRelationshipIsForOwnerClass(TypeWrapper ownerClassType, TypeWrapper reverseClassType, string reveresRelationshipName)
{
var reversePropInfo = reverseClassType.GetProperty(reveresRelationshipName);
Assert.IsNotNull(reversePropInfo, reveresRelationshipName + " on " + reverseClassType.Name + " should not be null");
Assert.AreSame(ownerClassType.UnderlyingType, reversePropInfo.RelatedClassType.UnderlyingType);
}
示例3: AssertReverseRelationshipHasIgnoreAttribute
private static void AssertReverseRelationshipHasIgnoreAttribute(TypeWrapper reverseClassType, string relName)
{
var singleRelProp = reverseClassType.GetProperty(relName);
Assert.IsTrue(singleRelProp.HasIgnoreAttribute, relName + " on " + reverseClassType.Name + " should have an ignore attribute");
}
示例4: AssertReverseRelationshipHasAutoMapToThisRel
private static void AssertReverseRelationshipHasAutoMapToThisRel(TypeWrapper reverseClassType, string relName, string expectedReversRelName)
{
var reverseRelProp = reverseClassType.GetProperty(relName);
var customRelationship = reverseRelProp.GetAttributes<AutoMapRelationshipAttribute>();
Assert.IsTrue(customRelationship.Any(o => (o.ReverseRelationshipName == expectedReversRelName)),
relName + " on " + reverseClassType.Name + " should have an AutoMapManyToOneAttribute attribute");
}
示例5: Test_HasProperty_WhenNotHas_ShouldReturnFalse
public void Test_HasProperty_WhenNotHas_ShouldReturnFalse()
{
//---------------Set up test pack-------------------
var type = MockRepository.GenerateMock<Type>();
var propName = GetRandomString();
TypeWrapper wrapper = new TypeWrapper(type);
//---------------Assert Precondition----------------
Assert.IsNull(type.GetProperty(propName));
Assert.IsNull(wrapper.GetProperty(propName));
//---------------Execute Test ----------------------
var hasProperty = wrapper.HasProperty(propName);
//---------------Test Result -----------------------
Assert.IsFalse(hasProperty);
}
示例6: Test_GetProperty_ShouldReturnFromType
public void Test_GetProperty_ShouldReturnFromType()
{
//---------------Set up test pack-------------------
var type = MockRepository.GenerateMock<Type>();
var propName = GetRandomString();
var expectedGetProperty = type.SetProperty(propName);
TypeWrapper wrapper = new TypeWrapper(type);
//---------------Assert Precondition----------------
Assert.AreSame(expectedGetProperty, type.GetProperty(propName));
//---------------Execute Test ----------------------
var getProperty = wrapper.GetProperty(propName);
//---------------Test Result -----------------------
Assert.AreSame(expectedGetProperty, getProperty.PropertyInfo);
}