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


C# ContactPersonTestBO.GetPropertyValue方法代码示例

本文整理汇总了C#中ContactPersonTestBO.GetPropertyValue方法的典型用法代码示例。如果您正苦于以下问题:C# ContactPersonTestBO.GetPropertyValue方法的具体用法?C# ContactPersonTestBO.GetPropertyValue怎么用?C# ContactPersonTestBO.GetPropertyValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ContactPersonTestBO的用法示例。


在下文中一共展示了ContactPersonTestBO.GetPropertyValue方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Test_SetPropertyValue_WithEnumString

        public void Test_SetPropertyValue_WithEnumString()
        {
            //---------------Set up test pack-------------------
            ContactPersonTestBO.LoadDefaultClassDefWithEnum();
            ContactPersonTestBO contactPersonTestBO = new ContactPersonTestBO();
            //-------------Assert Preconditions -------------

            //---------------Execute Test ----------------------
            contactPersonTestBO.SetPropertyValue("ContactType", "Business");
            //---------------Test Result -----------------------
            object value = contactPersonTestBO.GetPropertyValue("ContactType");
            Assert.IsInstanceOf(typeof (ContactPersonTestBO.ContactType), value);
            Assert.AreEqual(ContactPersonTestBO.ContactType.Business, value);
        }
开发者ID:Chillisoft,项目名称:habanero,代码行数:14,代码来源:TestBusinessObject.cs

示例2: Test_SetPropertyValue_WithDateTimeString_Invalid

 public void Test_SetPropertyValue_WithDateTimeString_Invalid()
 {
     //---------------Set up test pack-------------------
     SetupDefaultContactPersonBO();
     ContactPersonTestBO contactPersonTestBO = new ContactPersonTestBO();
     const string newDateTime = "31/11/2008";
     IBOProp prop = contactPersonTestBO.Props["DateOfBirth"];
     //-------------Assert Preconditions -------------
     Assert.IsNull(prop.Value);
     Assert.IsTrue(prop.IsValid);
     //---------------Execute Test ----------------------
     try
     {
         contactPersonTestBO.SetPropertyValue("DateOfBirth", newDateTime);
         Assert.Fail("expected Err");
     }
         //---------------Test Result -----------------------
     catch (HabaneroDeveloperException ex)
     {
         string message = string.Format("{0} cannot be set to {1}. It is not a type of"
                                        , "DateOfBirth", newDateTime);
         StringAssert.Contains(message, ex.Message);
         StringAssert.Contains("DateTime", ex.Message);
         object value = contactPersonTestBO.GetPropertyValue("DateOfBirth");
         Assert.IsNull(value);
         Assert.IsTrue(prop.IsValid);
     }
 }
开发者ID:Chillisoft,项目名称:habanero,代码行数:28,代码来源:TestBusinessObject.cs

示例3: Test_SetPropertyValue_WithDateTimeString

 public void Test_SetPropertyValue_WithDateTimeString()
 {
     //---------------Set up test pack-------------------
     SetupDefaultContactPersonBO();
     ContactPersonTestBO contactPersonTestBO = new ContactPersonTestBO();
     DateTime newDateTime = DateTime.Today.Add(new TimeSpan(6, 3, 2));
     //-------------Assert Preconditions -------------
     //---------------Execute Test ----------------------
     contactPersonTestBO.SetPropertyValue("DateOfBirth", newDateTime.ToString());
     //---------------Test Result -----------------------
     object value = contactPersonTestBO.GetPropertyValue("DateOfBirth");
     Assert.IsInstanceOf(typeof (DateTime), value);
     Assert.AreEqual(newDateTime, value);
 }
开发者ID:Chillisoft,项目名称:habanero,代码行数:14,代码来源:TestBusinessObject.cs

示例4: Test_GetPropertyValue_WithExpression_WhenInvalidProperty

        public void Test_GetPropertyValue_WithExpression_WhenInvalidProperty()
        {
            //---------------Set up test pack-------------------
            SetupDefaultContactPersonBO();
            ContactPersonTestBO contactPersonTestBO = new ContactPersonTestBO();
            //---------------Assert Precondition----------------

            //---------------Execute Test ----------------------
            try
            {
                var firstName = contactPersonTestBO.GetPropertyValue(testBo => testBo.FirstName + "123");
            }
            //---------------Test Result -----------------------
            catch (Exception ex)
            {
                Assert.IsInstanceOf<ArgumentException>(ex);
                StringAssert.Contains("testBo => (testBo.FirstName + \"123\") is not a valid property on ContactPersonTestBO", ex.Message);
            }
        }
开发者ID:Chillisoft,项目名称:habanero,代码行数:19,代码来源:TestBusinessObject.cs

示例5: Test_GetPropertyValue_WithExpression_ValueType

        public void Test_GetPropertyValue_WithExpression_ValueType()
        {
            //---------------Set up test pack-------------------
            SetupDefaultContactPersonBO();
            ContactPersonTestBO contactPersonTestBO = new ContactPersonTestBO();
            var originalDateTime = DateTime.Today.AddDays(-TestUtil.GetRandomInt(365));
            contactPersonTestBO.SetPropertyValue(bo => bo.DateOfBirth, originalDateTime);
            //---------------Assert Precondition----------------

            //---------------Execute Test ----------------------
            var dateOfBirth = contactPersonTestBO.GetPropertyValue(testBo => testBo.DateOfBirth);
            //---------------Test Result -----------------------
            Assert.AreEqual(originalDateTime, dateOfBirth);
        }
开发者ID:Chillisoft,项目名称:habanero,代码行数:14,代码来源:TestBusinessObject.cs

示例6: Test_GetPropertyValue_WithExpression

 public void Test_GetPropertyValue_WithExpression()
 {
     //---------------Set up test pack-------------------
     SetupDefaultContactPersonBO();
     ContactPersonTestBO contactPersonTestBO = new ContactPersonTestBO();
     var originalFirstName = TestUtil.GetRandomString();
     contactPersonTestBO.SetPropertyValue(bo => bo.FirstName, originalFirstName);
     //---------------Assert Precondition----------------
     
     //---------------Execute Test ----------------------
     var firstName = contactPersonTestBO.GetPropertyValue(testBo => testBo.FirstName);
     //---------------Test Result -----------------------
     Assert.AreEqual(originalFirstName, firstName);
 }
开发者ID:Chillisoft,项目名称:habanero,代码行数:14,代码来源:TestBusinessObject.cs


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