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


C# ContactPersonTestBO.ToString方法代码示例

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


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

示例1: Test_WhenSetThePropertyToABusinessObject_ShouldSetThePrimaryKey

        public void Test_WhenSetThePropertyToABusinessObject_ShouldSetThePrimaryKey()
        {
            //---------------Set up test pack-------------------
            ClassDef.ClassDefs.Clear();
            var classDef = MyBO.LoadClassDefWithBOLookup();
            ContactPersonTestBO.LoadDefaultClassDef();
            var cp = new ContactPersonTestBO();
            const string expectedSurname = "abc";
            cp.Surname = expectedSurname;
            var myBO = (BusinessObject)classDef.CreateNewBusinessObject();

            //---------------Assert Precondition----------------
            Assert.AreEqual(expectedSurname, cp.ToString());
            //---------------Execute Test ----------------------
            myBO.SetPropertyValue("TestProp2", cp);
            //---------------Test Result -----------------------
            Assert.AreEqual(cp.ContactPersonID, myBO.GetPropertyValue("TestProp2"), "This is the ID of the related object");
            Assert.AreEqual(expectedSurname, myBO.GetPropertyValueToDisplay("TestProp2"), "This is the ToString of the related object");
        }
开发者ID:kevinbosman,项目名称:habanero,代码行数:19,代码来源:TestBoMapper.cs

示例2: Test_AddBOToCol_WhenNullOrEmptyToString_ShouldRaiseError

 //TODO Mark 07 Aug 2009: NNB Review this - I don't think that this is the action you want because it could have side effects when creating a new BO
 public virtual void Test_AddBOToCol_WhenNullOrEmptyToString_ShouldRaiseError()
 {
     //---------------Set up test pack-------------------
     IComboBox cmbox = CreateComboBox();
     RelationshipComboBoxMapper mapper1 = GetMapper(cmbox);
     BusinessObjectCollection<ContactPersonTestBO> boCol = new BusinessObjectCollection<ContactPersonTestBO> { new ContactPersonTestBO() };
     mapper1.BusinessObjectCollection = boCol;
     RelationshipComboBoxMapper mapper = mapper1;
     ContactPersonTestBO newBO = new ContactPersonTestBO { Surname = "" };
     //---------------Assert Precondition----------------
     Assert.AreEqual(1, boCol.Count);
     Assert.AreEqual(2, mapper.Control.Items.Count);
     Assert.IsNull(newBO.ToString());
     //---------------Execute Test ----------------------
     try
     {
         boCol.Add(newBO);
         Assert.Fail("expected HabaneroDeveloperException");
     }
     //---------------Test Result -----------------------
     catch (HabaneroDeveloperException ex)
     {
         string message = string.Format("Cannot add a business object of type '{0}' "
                                        + "to the 'ComboBoxCollectionSelector' if its ToString is null or zero length"
                                        , newBO.ClassDef.ClassName);
         StringAssert.Contains(message, ex.Message);
     }
 }
开发者ID:Chillisoft,项目名称:habanero.faces,代码行数:29,代码来源:TestRelationshipComboBoxMapper.cs


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