本文整理汇总了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");
}
示例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);
}
}