本文整理汇总了C#中ContactPersonTestBO类的典型用法代码示例。如果您正苦于以下问题:C# ContactPersonTestBO类的具体用法?C# ContactPersonTestBO怎么用?C# ContactPersonTestBO使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ContactPersonTestBO类属于命名空间,在下文中一共展示了ContactPersonTestBO类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateContactPersonTestBO
private static ContactPersonTestBO CreateContactPersonTestBO()
{
ContactPersonTestBO bo = new ContactPersonTestBO();
string newSurname = Guid.NewGuid().ToString();
bo.Surname = newSurname;
bo.Save();
return bo;
}
示例2: TestReloadingRelationship
public void TestReloadingRelationship()
{
ClassDef.ClassDefs.Clear();
ContactPersonTestBO.LoadClassDefWithAddressesRelationship_DeleteRelated();
new AddressTestBO();
ContactPersonTestBO cp = new ContactPersonTestBO();
IBusinessObjectCollection addresses = cp.Addresses;
Assert.AreSame(addresses, cp.Addresses);
}
示例3: TestTypeOfMultipleCollection
public void TestTypeOfMultipleCollection()
{
ClassDef.ClassDefs.Clear();
ContactPersonTestBO.LoadClassDefWithAddressesRelationship_DeleteRelated();
new AddressTestBO();
ContactPersonTestBO cp = new ContactPersonTestBO();
Assert.AreSame(typeof(RelatedBusinessObjectCollection<AddressTestBO>), cp.Addresses.GetType());
}
示例4: CreateDirtyChildren
protected void CreateDirtyChildren(BusinessObjectCollection<ContactPersonTestBO> cpCol,
out ContactPersonTestBO existingChild,
out ContactPersonTestBO editedChild,
out ContactPersonTestBO deletedChild,
out ContactPersonTestBO createdChildWithEdits,
out ContactPersonTestBO createdChild)
{
createdChild = CreateCreatedChild(cpCol);
createdChildWithEdits = CreateCreatedChildWithEdits(cpCol);
existingChild = CreateExistingChild(cpCol);
editedChild = CreateEditedChild(cpCol);
deletedChild = CreateDeletedChild(cpCol);
}
示例5: Test_Constructor
public void Test_Constructor()
{
//---------------Set up test pack-------------------
ContactPersonTestBO contactPersonTestBO = new ContactPersonTestBO();
SingleRelationship<OrganisationTestBO> singleRelationship = contactPersonTestBO.Relationships.GetSingle<OrganisationTestBO>("Organisation");
//---------------Execute Test ----------------------
TransactionalSingleRelationship_Added tsr = new TransactionalSingleRelationship_Added(singleRelationship, new OrganisationTestBO());
//---------------Test Result -----------------------
Assert.AreSame(singleRelationship, tsr.Relationship);
//---------------Tear Down -------------------------
}
示例6: Test_Create_WhenRelatedProp_ShouldCreateBOPropMapper
public void Test_Create_WhenRelatedProp_ShouldCreateBOPropMapper()
{
//---------------Set up test pack-------------------
const string propName = "Organisation.Name";
var bo = new ContactPersonTestBO();
//---------------Assert Precondition----------------
Assert.IsTrue(bo.Relationships.Contains("Organisation"));
//---------------Execute Test ----------------------
IBOPropertyMapper propMapper = BOPropMapperFactory.CreateMapper(bo, propName);
//---------------Test Result -----------------------
Assert.IsInstanceOf<BOPropertyMapper>(propMapper);
Assert.AreEqual(propName, propMapper.PropertyName);
Assert.AreSame(bo, propMapper.BusinessObject);
}
示例7: Test_SetToNull
public void Test_SetToNull()
{
//---------------Set up test pack-------------------
OrganisationTestBO organisationTestBO = OrganisationTestBO.CreateSavedOrganisation();
SingleRelationship<ContactPersonTestBO> relationship = GetAssociationRelationship(organisationTestBO);
relationship.OwningBOHasForeignKey = false;
ContactPersonTestBO contactPerson = new ContactPersonTestBO();
contactPerson.Surname = TestUtil.GetRandomString();
contactPerson.FirstName = TestUtil.GetRandomString();
contactPerson.Organisation = organisationTestBO;
contactPerson.Save();
//---------------Assert Precondition----------------
Assert.AreSame(contactPerson, organisationTestBO.ContactPerson);
//---------------Execute Test ----------------------
organisationTestBO.ContactPerson = null;
//---------------Test Result -----------------------
Assert.IsNull(organisationTestBO.ContactPerson);
}
示例8: Test_BusinessObject
public void Test_BusinessObject()
{
//---------------Set up test pack-------------------
var readOnlyGrid = GetControlFactory().CreateReadOnlyGrid();
const string propName = "Addresses";
var mapper = CreateReadOnlyGridMapper(readOnlyGrid, propName);
ContactPersonTestBO.LoadClassDefWithAddressesRelationship_DeleteRelated();
ContactPersonTestBO contactPersonTestBO = new ContactPersonTestBO();
RelatedBusinessObjectCollection<AddressTestBO> addresses = contactPersonTestBO.Addresses;
//---------------Assert PreConditions---------------
Assert.IsNull(mapper.BusinessObject);
//---------------Execute Test ----------------------
mapper.BusinessObject = contactPersonTestBO;
//---------------Test Result -----------------------
Assert.AreSame(contactPersonTestBO, mapper.BusinessObject);
Assert.AreSame(addresses, readOnlyGrid.BusinessObjectCollection);
}
示例9: Test_AddMethod
public void Test_AddMethod()
{
//---------------Set up test pack-------------------
//ContactPersonTestBO.LoadDefaultClassDef();
BusinessObjectCollection<ContactPersonTestBO> cpCol = new BusinessObjectCollection<ContactPersonTestBO>();
ContactPersonTestBO myBO = new ContactPersonTestBO();
_businessObjectCollectionTestHelper.RegisterForAddedEvent(cpCol);
//---------------Assert Precondition----------------
Assert.AreEqual(0, cpCol.Count);
Assert.AreEqual(0, cpCol.AddedBusinessObjects.Count);
_businessObjectCollectionTestHelper.AssertAddedEventNotFired();
//---------------Execute Test ----------------------
cpCol.Add(myBO);
//---------------Test Result -----------------------
Assert.AreEqual(1, cpCol.Count, "One object should be in the cpCollection");
BusinessObjectCollectionTestHelper.AssertOneObjectInCurrentAndCreatedCollection(cpCol);
_businessObjectCollectionTestHelper.AssertAddedEventFired();
Assert.AreEqual(myBO, cpCol[0], "Added object should be in the cpCollection");
}
示例10: Test_ConcurrentSave
public void Test_ConcurrentSave()
{
//---------------Set up test pack-------------------
ClassDef.ClassDefs.Clear();
var classDef = ContactPersonTestBO.LoadDefaultClassDef();
FixtureEnvironment.ClearBusinessObjectManager();
TestUtil.WaitForGC();
//---------------Assert Precondition----------------
//---------------Execute Test ----------------------
Parallel.For(0, 1000, i =>
{
var person = new ContactPersonTestBO();
person.Surname = RandomValueGen.GetRandomString(1, 10);
person.Save();
});
//---------------Test Result -----------------------
}
示例11: Test_BusinessObject_WhenNull
public void Test_BusinessObject_WhenNull()
{
//---------------Set up test pack-------------------
IEditableGridControl editableGrid = GetControlFactory().CreateEditableGridControl();
const string propName = "Addresses";
EditableGridControlMapper mapper = new EditableGridControlMapper(editableGrid, propName, false, GetControlFactory());
ContactPersonTestBO.LoadClassDefWithAddressesRelationship_DeleteRelated();
ContactPersonTestBO contactPersonTestBO = new ContactPersonTestBO();
mapper.BusinessObject = contactPersonTestBO;
RelatedBusinessObjectCollection<AddressTestBO> addresses = contactPersonTestBO.Addresses;
//---------------Assert PreConditions---------------
Assert.AreSame(contactPersonTestBO, mapper.BusinessObject);
Assert.AreSame(addresses, editableGrid.BusinessObjectCollection);
//---------------Execute Test ----------------------
mapper.BusinessObject = null;
//---------------Test Result -----------------------
Assert.IsNull(mapper.BusinessObject);
Assert.AreSame(null, editableGrid.BusinessObjectCollection);
}
示例12: Test_AddedToObjectManager
public void Test_AddedToObjectManager()
{
//---------------Set up test pack-------------------
ContactPersonTestBO.LoadDefaultClassDef();
ContactPersonTestBO cp = new ContactPersonTestBO();
BusinessObjectManager boMan = BusinessObjectManager.Instance;
//---------------Assert Precondition----------------
Assert.AreEqual(0, boMan.Count);
//---------------Execute Test ----------------------
cp.Surname = TestUtil.CreateRandomString();
boMan.Add(cp);
//---------------Test Result -----------------------
Assert.AreEqual(1, boMan.Count);
Assert.IsTrue(boMan.Contains(cp));
Assert.IsTrue(boMan.Contains(cp.ID));
Assert.IsTrue(boMan.Contains(cp.ID.GetObjectId()));
Assert.AreSame(cp, boMan[cp.ID.GetObjectId()]);
Assert.AreSame(cp, boMan[cp.ID]);
}
示例13: Test_UpdateStateAsCommitted
public void Test_UpdateStateAsCommitted()
{
//---------------Set up test pack-------------------
ContactPersonTestBO contactPersonTestBO = new ContactPersonTestBO();
OrganisationTestBO organisationTestBO = new OrganisationTestBO();
SingleRelationship<OrganisationTestBO> singleRelationship = contactPersonTestBO.Relationships.GetSingle<OrganisationTestBO>("Organisation");
singleRelationship.SetRelatedObject(organisationTestBO);
IRelationship relationship = organisationTestBO.Relationships.GetMultiple<ContactPersonTestBO>("ContactPeople");
TransactionalSingleRelationship_Added tsr = new TransactionalSingleRelationship_Added(relationship, contactPersonTestBO);
IBOProp relationshipProp = contactPersonTestBO.Props["OrganisationID"];
//---------------Assert PreConditions---------------
Assert.IsTrue(relationshipProp.IsDirty);
Assert.AreNotEqual(relationshipProp.Value, relationshipProp.PersistedPropertyValue);
//---------------Execute Test ----------------------
tsr.UpdateStateAsCommitted();
//---------------Test Result -----------------------
Assert.IsFalse(relationshipProp.IsDirty);
Assert.AreEqual(relationshipProp.Value, relationshipProp.PersistedPropertyValue);
}
示例14: Test_SetBusinessObject_ShouldSetTextOnExtendedTextBox
public void Test_SetBusinessObject_ShouldSetTextOnExtendedTextBox()
{
//--------------- Set up test pack ------------------
ExtendedTextBoxMapper mapper = CreateExtendedLookupComboBoxMapper("Surname");
ContactPersonTestBO businessObjectInfo = new ContactPersonTestBO();
var expectedTextBoxValue = TestUtil.GetRandomString();
businessObjectInfo.Surname = expectedTextBoxValue;
//--------------- Test Preconditions ----------------
Assert.IsNotNullOrEmpty(businessObjectInfo.Surname);
//--------------- Execute Test ----------------------
mapper.BusinessObject = businessObjectInfo;
//--------------- Test Result -----------------------
Assert.AreSame(businessObjectInfo, mapper.BusinessObject);
IExtendedTextBox extendedTextBox = (IExtendedTextBox)mapper.Control;
Assert.AreEqual(expectedTextBoxValue, extendedTextBox.Text, "Text should be set on TextBox");
}
示例15: Test_SetBusinessObject_OnInternalLookupComboBoxMapper
public void Test_SetBusinessObject_OnInternalLookupComboBoxMapper()
{
//--------------- Set up test pack ------------------
ExtendedTextBoxMapper mapper = CreateExtendedLookupComboBoxMapper("Surname");
//--------------- Test Preconditions ----------------
Assert.IsNull(mapper.BusinessObject);
Assert.IsNull(mapper.BusinessObject);
ContactPersonTestBO businessObjectInfo = new ContactPersonTestBO();
//--------------- Execute Test ----------------------
mapper.BusinessObject = businessObjectInfo;
//--------------- Test Result -----------------------
Assert.AreSame(businessObjectInfo, mapper.BusinessObject);
}