当前位置: 首页>>代码示例>>C#>>正文


C# TypeWrapper.GetProperty方法代码示例

本文整理汇总了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);
 }
开发者ID:Chillisoft,项目名称:habanero.smooth,代码行数:6,代码来源:TestAutoMapperExtensions.cs

示例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);
 }
开发者ID:Chillisoft,项目名称:habanero.smooth,代码行数:6,代码来源:TestAutoMapperExtensions.cs

示例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");
 }
开发者ID:Chillisoft,项目名称:habanero.smooth,代码行数:5,代码来源:TestAutoMapperExtensions.cs

示例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");

        }
开发者ID:Chillisoft,项目名称:habanero.smooth,代码行数:9,代码来源:TestAutoMapperExtensions.cs

示例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);
 }
开发者ID:Chillisoft,项目名称:habanero.smooth,代码行数:14,代码来源:TestTypeWrapper.cs

示例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);
 }
开发者ID:Chillisoft,项目名称:habanero.smooth,代码行数:14,代码来源:TestTypeWrapper.cs


注:本文中的TypeWrapper.GetProperty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。