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);
        }
        public void Test_UpdateStateAsCommitted_UpdateDirtyStatus_IDOnly()
        {
            //---------------Set up test pack-------------------
            ContactPersonTestBO contactPersonTestBO = ContactPersonTestBO.CreateSavedContactPerson();
            OrganisationTestBO organisationTestBO = OrganisationTestBO.CreateSavedOrganisation();

            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);
            
            //---------------Assert PreConditions--------------- 
            Assert.IsTrue(contactPersonTestBO.Status.IsDirty);
            
            //---------------Execute Test ----------------------
            tsr.UpdateStateAsCommitted();
            
            //---------------Test Result -----------------------
            Assert.IsFalse(contactPersonTestBO.Status.IsDirty);
            //---------------Tear Down -------------------------          
        }
        public void Test_UpdateStateAsCommitted_UpdateDirtyStatus_OtherDirtyField()
        {
            //---------------Set up test pack-------------------
            ContactPersonTestBO contactPersonTestBO = ContactPersonTestBO.CreateSavedContactPerson();
            OrganisationTestBO organisationTestBO = new OrganisationTestBO();

            SingleRelationship<OrganisationTestBO> singleRelationship = contactPersonTestBO.Relationships.GetSingle<OrganisationTestBO>("Organisation");
            singleRelationship.SetRelatedObject(organisationTestBO);
            TransactionalSingleRelationship_Added tsr = new TransactionalSingleRelationship_Added(singleRelationship, organisationTestBO);

            contactPersonTestBO.Surname = TestUtil.GetRandomString();
            
            //---------------Assert PreConditions--------------- 
            Assert.IsTrue(contactPersonTestBO.Status.IsDirty);
            
            //---------------Execute Test ----------------------
            tsr.UpdateStateAsCommitted();
            
            //---------------Test Result -----------------------
            Assert.IsTrue(contactPersonTestBO.Status.IsDirty);
            //---------------Tear Down -------------------------          
        }
        public void Test_UpdateStateAsCommitted_Added_UpdatesCols()
        {
            //---------------Set up test pack-------------------
            ContactPersonTestBO contactPersonTestBO = ContactPersonTestBO.CreateSavedContactPerson();
            OrganisationTestBO organisationTestBO = new OrganisationTestBO();

            //SingleRelationship<OrganisationTestBO> singleRelationship = contactPersonTestBO.Relationships.GetSingle<OrganisationTestBO>("Organisation");
            BusinessObjectCollection<ContactPersonTestBO> people = organisationTestBO.ContactPeople;
            contactPersonTestBO.Organisation = organisationTestBO;
            IRelationship relationship = organisationTestBO.Relationships.GetMultiple<ContactPersonTestBO>("ContactPeople");
            TransactionalSingleRelationship_Added tsr = new TransactionalSingleRelationship_Added(relationship, contactPersonTestBO);
            //---------------Assert PreConditions--------------- 

            Assert.AreEqual(1, people.AddedBusinessObjects.Count);
            Assert.AreEqual(0, people.PersistedBusinessObjects.Count);
            //---------------Execute Test ----------------------

            tsr.UpdateStateAsCommitted();
            //---------------Test Result -----------------------

            Assert.AreEqual(0, people.AddedBusinessObjects.Count);
            Assert.AreEqual(1, people.PersistedBusinessObjects.Count);
            //---------------Tear Down -------------------------          
        }