コード例 #1
0
        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();
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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();
        }
コード例 #4
0
        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();
        }