本文整理汇总了C#中ContactPersonTestBO.MarkForDelete方法的典型用法代码示例。如果您正苦于以下问题:C# ContactPersonTestBO.MarkForDelete方法的具体用法?C# ContactPersonTestBO.MarkForDelete怎么用?C# ContactPersonTestBO.MarkForDelete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ContactPersonTestBO
的用法示例。
在下文中一共展示了ContactPersonTestBO.MarkForDelete方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetAssociationRelationship
private static OrganisationTestBO CreateSavedOrganisation_WithOneMarkForDeleteContactPerson
(out ContactPersonTestBO contactPerson, out MultipleRelationship<ContactPersonTestBO> relationship)
{
OrganisationTestBO organisationTestBO = OrganisationTestBO.CreateSavedOrganisation();
BusinessObjectCollection<ContactPersonTestBO> cpCol;
relationship = GetAssociationRelationship(organisationTestBO, out cpCol);
contactPerson = ContactPersonTestBO.CreateSavedContactPerson
(TestUtil.GetRandomString(), TestUtil.GetRandomString());
cpCol.Add(contactPerson);
cpCol.SaveAll();
contactPerson.MarkForDelete();
return organisationTestBO;
}
示例2: Test_GetDirtyChildren_MarkedForDelete
public void Test_GetDirtyChildren_MarkedForDelete()
{
//---------------Set up test pack-------------------
OrganisationTestBO organisationTestBO = OrganisationTestBO.CreateSavedOrganisation();
SingleRelationship<ContactPersonTestBO> relationship = GetCompositionRelationship(organisationTestBO);
ContactPersonTestBO myBO = new ContactPersonTestBO();
myBO.Surname = TestUtil.GetRandomString();
myBO.FirstName = TestUtil.GetRandomString();
myBO.Organisation = organisationTestBO;
organisationTestBO.Save();
myBO.MarkForDelete();
//---------------Execute Test ----------------------
IList<ContactPersonTestBO> dirtyChildren = relationship.GetDirtyChildren();
//---------------Test Result -----------------------
Assert.Contains(myBO, (ICollection)dirtyChildren);
Assert.AreEqual(1, dirtyChildren.Count);
}
示例3: Test_RestoreAll
public void Test_RestoreAll()
{
ContactPersonTestBO.LoadDefaultClassDef();
ContactPersonTestBO contact1 = new ContactPersonTestBO {Surname = "Soap"};
ContactPersonTestBO contact2 = new ContactPersonTestBO {Surname = "Hope"};
BusinessObjectCollection<ContactPersonTestBO> col = new BusinessObjectCollection<ContactPersonTestBO> {contact1, contact2};
col.SaveAll();
Assert.AreEqual("Soap", col[0].Surname);
Assert.AreEqual("Hope", col[1].Surname);
contact1.Surname = "Cope";
contact2.Surname = "Pope";
Assert.AreEqual("Cope", col[0].Surname);
Assert.AreEqual("Pope", col[1].Surname);
col.CancelEdits();
Assert.AreEqual("Soap", col[0].Surname);
Assert.AreEqual("Hope", col[1].Surname);
contact1.MarkForDelete();
contact2.MarkForDelete();
col.SaveAll();
Assert.AreEqual(0, col.Count);
}
示例4: Test_DirtyIfHasMarkForDeleteChildren
public void Test_DirtyIfHasMarkForDeleteChildren()
{
//---------------Set up test pack-------------------
OrganisationTestBO organisationTestBO = OrganisationTestBO.CreateSavedOrganisation();
SingleRelationship<ContactPersonTestBO> relationship = GetCompositionRelationship(organisationTestBO);
ContactPersonTestBO myBO = new ContactPersonTestBO();
myBO.Surname = TestUtil.GetRandomString();
myBO.FirstName = TestUtil.GetRandomString();
myBO.Organisation = organisationTestBO;
organisationTestBO.Save();
//---------------Assert Precondition----------------
Assert.IsFalse(relationship.IsDirty);
//---------------Execute Test ----------------------
myBO.MarkForDelete();
bool isDirty = relationship.IsDirty;
//---------------Test Result -----------------------
Assert.IsTrue(isDirty);
}
示例5: DoTestCheckForDuplicateObjects
private static void DoTestCheckForDuplicateObjects()
{
ContactPersonTestBO contactPersonCompositeKey = GetSavedContactPersonCompositeKey();
FixtureEnvironment.ClearBusinessObjectManager();
ContactPersonTestBO duplicateContactPerson = new ContactPersonTestBO
{
ContactPersonID = Guid.NewGuid(),
Surname = contactPersonCompositeKey.Surname,
FirstName = contactPersonCompositeKey.FirstName
};
TransactionCommitterDB committer = new TransactionCommitterDB(DatabaseConnection.CurrentConnection);
committer.AddBusinessObject(duplicateContactPerson);
//---------------Execute Test ----------------------
try
{
committer.CommitTransaction();
Assert.Fail();
}
//---------------Test Result -----------------------
catch (BusObjDuplicateConcurrencyControlException ex)
{
StringAssert.Contains("Surname", ex.Message);
StringAssert.Contains("FirstName", ex.Message);
}
finally
{
//---------------Tear Down--------------------------
contactPersonCompositeKey.MarkForDelete();
contactPersonCompositeKey.Save();
if (!duplicateContactPerson.Status.IsNew)
{
duplicateContactPerson.MarkForDelete();
duplicateContactPerson.Save();
}
}
}