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 TestAddMethod_PersistedObject_IgnoresAddWhenItemAlreadyExists() { //---------------Set up test pack------------------- BusinessObjectCollection <ContactPersonTestBO> cpCol = new BusinessObjectCollection <ContactPersonTestBO>(); ContactPersonTestBO myBO = ContactPersonTestBO.CreateSavedContactPerson(); cpCol.Add(myBO); _businessObjectCollectionTestHelper.RegisterForAddedEvent(cpCol); //---------------Assert Precondition---------------- BusinessObjectCollectionTestHelper.AssertOneObjectInCurrentAndAddedCollection(cpCol); _businessObjectCollectionTestHelper.AssertAddedEventNotFired(); //---------------Execute Test ---------------------- cpCol.Add(myBO); //---------------Test Result ----------------------- BusinessObjectCollectionTestHelper.AssertOneObjectInCurrentAndAddedCollection(cpCol); _businessObjectCollectionTestHelper.AssertAddedEventNotFired(); }
public void TestAddMethod_SaveBusinessObject() { //---------------Set up test pack------------------- BusinessObjectCollection <ContactPersonTestBO> cpCol = new BusinessObjectCollection <ContactPersonTestBO>(); ContactPersonTestBO myBO = ContactPersonTestBO.CreateSavedContactPerson(); cpCol.Add(myBO); myBO.Surname = TestUtil.GetRandomString(); _businessObjectCollectionTestHelper.RegisterForAddedEvent(cpCol); //---------------Assert Precondition---------------- BusinessObjectCollectionTestHelper.AssertOneObjectInCurrentAndAddedCollection(cpCol); _businessObjectCollectionTestHelper.AssertAddedEventNotFired(); //---------------Execute Test ---------------------- myBO.Save(); //---------------Test Result ----------------------- BusinessObjectCollectionTestHelper.AssertOneObjectInCurrentPersistedAndAddedCollection(cpCol); _businessObjectCollectionTestHelper.AssertAddedEventNotFired(); }
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 TestAddMethod_Refresh_LoadWithCriteria_BusinessObject() { //---------------Set up test pack------------------- BusinessObjectCollection <ContactPersonTestBO> cpCol = new BusinessObjectCollection <ContactPersonTestBO>(); cpCol.Load("Surname='bbb'", ""); ContactPersonTestBO myBO = ContactPersonTestBO.CreateSavedContactPerson("aaa"); cpCol.Add(myBO); _businessObjectCollectionTestHelper.RegisterForAddedAndRemovedEvents(cpCol); //---------------Assert Precondition---------------- BusinessObjectCollectionTestHelper.AssertOneObjectInCurrentAndAddedCollection(cpCol); Assert.IsFalse(myBO.Status.IsDirty); _businessObjectCollectionTestHelper.AssertAddedAndRemovedEventsNotFired(); //---------------Execute Test ---------------------- cpCol.Refresh(); //---------------Test Result ----------------------- BusinessObjectCollectionTestHelper.AssertOneObjectInCurrentAndAddedCollection(cpCol); Assert.IsFalse(myBO.Status.IsDirty); _businessObjectCollectionTestHelper.AssertAddedAndRemovedEventsNotFired(); }
public void TestAddMethod_RestoreBusinessObject() { //---------------Set up test pack------------------- BusinessObjectCollection <ContactPersonTestBO> cpCol = new BusinessObjectCollection <ContactPersonTestBO>(); ContactPersonTestBO myBO = ContactPersonTestBO.CreateSavedContactPerson(); cpCol.Add(myBO); myBO.Surname = TestUtil.GetRandomString(); _businessObjectCollectionTestHelper.RegisterForAddedAndRemovedEvents(cpCol); //---------------Assert Precondition---------------- BusinessObjectCollectionTestHelper.AssertOneObjectInCurrentAndAddedCollection(cpCol); Assert.IsTrue(myBO.Status.IsDirty); _businessObjectCollectionTestHelper.AssertAddedAndRemovedEventsNotFired(); //---------------Execute Test ---------------------- myBO.CancelEdits(); //---------------Test Result ----------------------- BusinessObjectCollectionTestHelper.AssertOneObjectInCurrentAndAddedCollection(cpCol); Assert.IsFalse(myBO.Status.IsDirty); _businessObjectCollectionTestHelper.AssertAddedAndRemovedEventsNotFired(); }