public void Test_MarkForDelete_Added_RestoreBO_LoadWCriteria() { //---------------Set up test pack------------------- BusinessObjectCollection <ContactPersonTestBO> cpCol = new BusinessObjectCollection <ContactPersonTestBO>(); cpCol.Load("Surname=cc", ""); ContactPersonTestBO myBO = ContactPersonTestBO.CreateSavedContactPerson("BB"); cpCol.Add(myBO); myBO.MarkForDelete(); _businessObjectCollectionTestHelper.RegisterForAddedAndRemovedEvents(cpCol); //---------------Assert Precondition---------------- BusinessObjectCollectionTestHelper.AssertOneObjectInMarkForDeleteAndAddedCollection(cpCol); Assert.IsTrue(myBO.Status.IsDirty); //---------------Execute Test ---------------------- myBO.CancelEdits(); //---------------Test Result ----------------------- BusinessObjectCollectionTestHelper.AssertOneObjectInCurrentAndAddedCollection(cpCol); Assert.IsFalse(myBO.Status.IsDirty); _businessObjectCollectionTestHelper.AssertAddedEventFired(); _businessObjectCollectionTestHelper.AssertRemovedEventNotFired(); }
public void Test_MarkForDelete_Added_boSave() { //---------------Set up test pack------------------- BusinessObjectCollection <ContactPersonTestBO> cpCol = new BusinessObjectCollection <ContactPersonTestBO>(); ContactPersonTestBO myBO = ContactPersonTestBO.CreateSavedContactPerson("BB"); cpCol.Add(myBO); myBO.MarkForDelete(); //---------------Assert Precondition---------------- BusinessObjectCollectionTestHelper.AssertOneObjectInMarkForDeleteAndAddedCollection(cpCol); Assert.IsTrue(myBO.Status.IsDirty); //---------------Execute Test ---------------------- myBO.Save(); //---------------Test Result ----------------------- BusinessObjectCollectionTestHelper.AssertAllCollectionsHaveNoItems(cpCol); Assert.IsFalse(myBO.Status.IsDirty); }
public void TestAddMethod_MarkForDeleteAddedBusinessObject() { //---------------Set up test pack------------------- BusinessObjectCollection <ContactPersonTestBO> cpCol = new BusinessObjectCollection <ContactPersonTestBO>(); ContactPersonTestBO myBO = ContactPersonTestBO.CreateSavedContactPerson(); cpCol.Add(myBO); _businessObjectCollectionTestHelper.RegisterForAddedAndRemovedEvents(cpCol); //---------------Assert Precondition---------------- BusinessObjectCollectionTestHelper.AssertOneObjectInCurrentAndAddedCollection(cpCol); Assert.IsFalse(myBO.Status.IsDirty); _businessObjectCollectionTestHelper.AssertAddedAndRemovedEventsNotFired(); //---------------Execute Test ---------------------- cpCol.MarkForDelete(myBO); //---------------Test Result ----------------------- BusinessObjectCollectionTestHelper.AssertOneObjectInMarkForDeleteAndAddedCollection(cpCol); Assert.IsTrue(myBO.Status.IsDirty); _businessObjectCollectionTestHelper.AssertRemovedEventFired(); }
public void Test_MarkForDelete_Added_RefreshAll() { //---------------Set up test pack------------------- ContactPersonTestBO myBO = ContactPersonTestBO.CreateSavedContactPerson(); BusinessObjectCollection <ContactPersonTestBO> cpCol = new BusinessObjectCollection <ContactPersonTestBO>(); cpCol.Load(new Criteria("Surname", Criteria.ComparisonOp.Equals, TestUtil.GetRandomString()), ""); cpCol.Add(myBO); myBO.MarkForDelete(); _businessObjectCollectionTestHelper.RegisterForAddedAndRemovedEvents(cpCol); //---------------Assert Precondition---------------- BusinessObjectCollectionTestHelper.AssertOneObjectInMarkForDeleteAndAddedCollection(cpCol); Assert.IsTrue(myBO.Status.IsDirty); _businessObjectCollectionTestHelper.AssertAddedAndRemovedEventsNotFired(); //---------------Execute Test ---------------------- cpCol.Refresh(); //---------------Test Result ----------------------- BusinessObjectCollectionTestHelper.AssertOneObjectInMarkForDeleteAndAddedCollection(cpCol); Assert.IsTrue(myBO.Status.IsDirty); _businessObjectCollectionTestHelper.AssertAddedAndRemovedEventsNotFired(); }