public virtual void Test_RemovedChild_UpdatesRelatedPropertiesOnlyWhenParentSaves() { //---------------Set up test pack------------------- OrganisationTestBO organisation = OrganisationTestBO.CreateSavedOrganisation(); SingleRelationship <ContactPersonTestBO> relationship = GetAssociationRelationship(organisation); relationship.OwningBOHasForeignKey = false; ContactPersonTestBO contactPerson = ContactPersonTestBO.CreateSavedContactPerson(); organisation.ContactPerson = contactPerson; organisation.Save(); contactPerson.Surname = TestUtil.GetRandomString(); organisation.ContactPerson = null; //---------------Assert PreConditions--------------- Assert.IsTrue(contactPerson.Status.IsDirty); Assert.IsTrue(contactPerson.Props["OrganisationID"].IsDirty); Assert.IsNull(contactPerson.Props["OrganisationID"].Value); Assert.IsTrue(organisation.Status.IsDirty); //---------------Execute Test ---------------------- organisation.Save(); //---------------Test Result ----------------------- Assert.IsTrue(contactPerson.Status.IsDirty); Assert.IsFalse(contactPerson.Props["OrganisationID"].IsDirty); Assert.IsNull(contactPerson.Props["OrganisationID"].Value); Assert.IsFalse(organisation.Status.IsDirty); }
public override void Test_ApplyChangesToBusinessObject_WhenNewItemIsSelected_WhenSet_WhenRelationshipIsLevelsDeep_ShouldUpdateRelatedBusinessObjectWithSelectedValue() { //---------------Set up test pack------------------- ClassDef.ClassDefs.Clear(); ContactPersonTestBO.LoadClassDefWithOrganisationAndAddressRelationships(); OrganisationTestBO.LoadDefaultClassDef(); AddressTestBO.LoadDefaultClassDef(); const string relationshipName = "ContactPersonTestBO.Organisation"; var mapper = GetMapperBoColHasOneItem(relationshipName); var cmbox = mapper.Control; var boCol = (BusinessObjectCollection <OrganisationTestBO>)mapper.BusinessObjectCollection; var person = new ContactPersonTestBO { Organisation = boCol[0] }; var addressTestBO = new AddressTestBO { ContactPersonTestBO = person }; var newOrganisation = new OrganisationTestBO(); newOrganisation.Save(); mapper.BusinessObject = addressTestBO; //---------------Assert Precondition---------------- Assert.AreSame(addressTestBO, mapper.BusinessObject); Assert.AreSame(person.Organisation, cmbox.SelectedItem); Assert.AreNotSame(person.Organisation, newOrganisation); //---------------Execute Test ---------------------- cmbox.SelectedItem = newOrganisation; Assert.AreSame(newOrganisation, cmbox.SelectedItem, "Selected Item should be set."); mapper.ApplyChangesToBusinessObject(); //---------------Test Result ----------------------- Assert.AreSame(newOrganisation, cmbox.SelectedItem); Assert.AreSame(newOrganisation, person.Organisation); }
public virtual void Test_RemovedChild_UpdatesRelatedPropertiesOnlyWhenParentSaves() { //---------------Set up test pack------------------- OrganisationTestBO organisationTestBO = OrganisationTestBO.CreateSavedOrganisation(); RelationshipDef relationshipDef = (RelationshipDef)organisationTestBO.Relationships["ContactPeople"].RelationshipDef; relationshipDef.RelationshipType = RelationshipType.Association; ContactPersonTestBO contactPerson = organisationTestBO.ContactPeople.CreateBusinessObject(); contactPerson.Surname = TestUtil.GetRandomString(); contactPerson.FirstName = TestUtil.GetRandomString(); contactPerson.Save(); contactPerson.Surname = TestUtil.GetRandomString(); organisationTestBO.ContactPeople.Remove(contactPerson); //---------------Assert PreConditions--------------- Assert.IsTrue(contactPerson.Status.IsDirty); Assert.IsTrue(contactPerson.Props["OrganisationID"].IsDirty); Assert.IsNull(contactPerson.Props["OrganisationID"].Value); Assert.IsTrue(organisationTestBO.Status.IsDirty); //---------------Execute Test ---------------------- organisationTestBO.Save(); //---------------Test Result ----------------------- Assert.IsTrue(contactPerson.Status.IsDirty); Assert.IsFalse(contactPerson.Props["OrganisationID"].IsDirty); Assert.IsNull(contactPerson.Props["OrganisationID"].Value); Assert.IsFalse(organisationTestBO.Status.IsDirty); }
public void Test_PersistParent_PersistsDirtyChildren() { //---------------Set up test pack------------------- OrganisationTestBO organisationTestBO = OrganisationTestBO.CreateSavedOrganisation(); RelationshipCol relationships = organisationTestBO.Relationships; BusinessObjectCollection <ContactPersonTestBO> cpCol; MultipleRelationship <ContactPersonTestBO> aggregateRelationship = GetAggregationRelationship (organisationTestBO, out cpCol); ContactPersonTestBO myBO = cpCol.CreateBusinessObject(); myBO.Surname = TestUtil.GetRandomString(); myBO.FirstName = TestUtil.GetRandomString(); myBO.Save(); myBO.FirstName = TestUtil.GetRandomString(); //---------------Assert Precondition---------------- Assert.IsTrue(aggregateRelationship.IsDirty); Assert.IsTrue(myBO.Status.IsDirty); Assert.IsTrue(relationships.IsDirty); Assert.IsTrue(organisationTestBO.Status.IsDirty); //---------------Execute Test ---------------------- organisationTestBO.Save(); //---------------Test Result ----------------------- Assert.IsFalse(myBO.Status.IsDirty); Assert.IsFalse(aggregateRelationship.IsDirty); Assert.IsFalse(relationships.IsDirty); Assert.IsFalse(organisationTestBO.Status.IsDirty); }
public virtual void Test_AddedChild_UpdatesRelatedPropertiesOnlyWhenParentSaves() { //---------------Set up test pack------------------- OrganisationTestBO organisation = OrganisationTestBO.CreateSavedOrganisation(); GetAssociationRelationship(organisation); ContactPersonTestBO contactPerson = ContactPersonTestBO.CreateSavedContactPerson(); organisation.ContactPerson = contactPerson; contactPerson.Surname = TestUtil.GetRandomString(); //---------------Assert PreConditions--------------- Assert.IsTrue(contactPerson.Status.IsDirty); Assert.IsTrue(contactPerson.Props["OrganisationID"].IsDirty); Assert.IsTrue(organisation.Status.IsDirty); //---------------Execute Test ---------------------- organisation.Save(); //---------------Test Result ----------------------- Assert.IsTrue(contactPerson.Status.IsDirty); Assert.IsFalse(contactPerson.Props["OrganisationID"].IsDirty); Assert.IsFalse(organisation.Status.IsDirty); //---------------Tear Down ------------------------- }
public void Test_GetDirtyChildren_MarkedForDelete() { //---------------Set up test pack------------------- OrganisationTestBO organisationTestBO = OrganisationTestBO.CreateSavedOrganisation(); SingleRelationship <ContactPersonTestBO> relationship = GetAssociationRelationship(organisationTestBO); ContactPersonTestBO myBO = new ContactPersonTestBO(); myBO.Surname = TestUtil.GetRandomString(); myBO.FirstName = TestUtil.GetRandomString(); myBO.Organisation = organisationTestBO; organisationTestBO.Save(); ReflectionUtilities.SetPropertyValue(myBO.Status, "IsDeleted", true); //ReflectionUtilities.SetPropertyValue(myBO.Status, "IsDirty", true); //---------------Assert Preconditions--------------- Assert.IsTrue(myBO.Status.IsDeleted); Assert.IsTrue(myBO.Status.IsDirty); //---------------Execute Test ---------------------- IList <ContactPersonTestBO> dirtyChildren = relationship.GetDirtyChildren(); //---------------Test Result ----------------------- Assert.AreEqual(1, dirtyChildren.Count); Assert.Contains(myBO, (ICollection)dirtyChildren); }
public void Test_AddedChild_UpdatesRelatedPropertiesOnlyWhenParentSaves_OnlyIDChanged() { //---------------Set up test pack------------------- OrganisationTestBO organisationTestBO = OrganisationTestBO.CreateSavedOrganisation(); ContactPersonTestBO contactPerson = ContactPersonTestBO.CreateSavedContactPerson(); RelationshipDef relationshipDef = (RelationshipDef)organisationTestBO.Relationships["ContactPeople"].RelationshipDef; relationshipDef.RelationshipType = RelationshipType.Association; organisationTestBO.ContactPeople.Add(contactPerson); //---------------Assert PreConditions--------------- Assert.IsTrue(contactPerson.Status.IsDirty); Assert.IsTrue(contactPerson.Props["OrganisationID"].IsDirty); Assert.IsTrue(organisationTestBO.Status.IsDirty); //---------------Execute Test ---------------------- organisationTestBO.Save(); //---------------Test Result ----------------------- Assert.IsFalse(contactPerson.Status.IsDirty); Assert.IsFalse(contactPerson.Props["OrganisationID"].IsDirty); Assert.IsFalse(organisationTestBO.Status.IsDirty); //---------------Tear Down ------------------------- }
public void Test_UpdateStateAsCommitted_Removed_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; organisationTestBO.Save(); contactPersonTestBO.Organisation = organisationTestBO; contactPersonTestBO.Save(); contactPersonTestBO.Organisation = null; IRelationship relationship = organisationTestBO.Relationships.GetMultiple <ContactPersonTestBO>("ContactPeople"); TransactionalSingleRelationship_Removed tsr = new TransactionalSingleRelationship_Removed(relationship, contactPersonTestBO); //---------------Assert PreConditions--------------- Assert.AreEqual(1, people.RemovedBusinessObjects.Count); Assert.AreEqual(1, people.PersistedBusinessObjects.Count); Assert.IsTrue(singleRelationship.IsRemoved); //---------------Execute Test ---------------------- tsr.UpdateStateAsCommitted(); //---------------Test Result ----------------------- Assert.AreEqual(0, people.RemovedBusinessObjects.Count); Assert.AreEqual(0, people.PersistedBusinessObjects.Count); // Assert.IsFalse(singleRelationship.IsRemoved); //---------------Tear Down ------------------------- }
protected static ContactPersonTestBO CreateRemovedChild_ChildOwnsEdit(OrganisationTestBO organisationTestBO) { ContactPersonTestBO removedChild = ContactPersonTestBO.CreateUnsavedContactPerson(); removedChild.Organisation = organisationTestBO; organisationTestBO.Save(); removedChild.Organisation = null; return(removedChild); }
private static ContactPersonTestBO CreateSavedContactPersonTestBoAndOrganisation() { OrganisationTestBO organisationTestBO = OrganisationTestBO.CreateSavedOrganisation(); ContactPersonTestBO contactPersonTestBO = organisationTestBO.ContactPeople.CreateBusinessObject(); contactPersonTestBO.Surname = TestUtil.GetRandomString(); contactPersonTestBO.FirstName = TestUtil.GetRandomString(); organisationTestBO.Save(); contactPersonTestBO.Save(); return(contactPersonTestBO); }
public void Test_NewChild_SavesWhenParentSaves() { //---------------Set up test pack------------------- OrganisationTestBO organisation = OrganisationTestBO.CreateSavedOrganisation(); GetAssociationRelationship(organisation); ContactPersonTestBO contactPerson = ContactPersonTestBO.CreateUnsavedContactPerson(); organisation.ContactPerson = contactPerson; //---------------Execute Test ---------------------- organisation.Save(); //---------------Test Result ----------------------- Assert.IsFalse(contactPerson.Status.IsDirty); }
public void Test_RemovedChild_UpdatesRelatedPropertiesOnlyWhenParentSaves_DB() { //---------------Set up test pack------------------- TestUsingDatabase.SetupDBDataAccessor(); OrganisationTestBO organisation = OrganisationTestBO.CreateSavedOrganisation(); SingleRelationship <ContactPersonTestBO> relationship = GetAssociationRelationship(organisation); relationship.OwningBOHasForeignKey = false; ContactPersonTestBO contactPerson = ContactPersonTestBO.CreateSavedContactPerson(); organisation.ContactPerson = contactPerson; organisation.Save(); contactPerson.Surname = TestUtil.GetRandomString(); organisation.ContactPerson = null; //---------------Execute Test ---------------------- organisation.Save(); FixtureEnvironment.ClearBusinessObjectManager(); ContactPersonTestBO loadedContactPerson = Broker.GetBusinessObject <ContactPersonTestBO>(contactPerson.ID); //---------------Test Result ----------------------- Assert.IsNull(loadedContactPerson.OrganisationID); }
public override void Test_KeyPressEventUpdatesBusinessObject_WithoutCallingApplyChanges() { //---------------Set up test pack------------------- IComboBox cmbox = CreateComboBox(); BusinessObjectCollection <OrganisationTestBO> boCol; RelationshipComboBoxMapper mapper = GetMapperBoColHasOneItem(cmbox, out boCol); OrganisationTestBO newBO = boCol.CreateBusinessObject(); newBO.Save(); OrganisationTestBO organisationTestBO = boCol[0]; ContactPersonTestBO person = CreateCPWithRelatedOrganisation(organisationTestBO); mapper.BusinessObject = person; //---------------Execute Test ---------------------- cmbox.Text = newBO.ToString(); //---------------Test Result ----------------------- Assert.AreSame(newBO, person.Organisation, "For Windows the value should be changed."); }
public void Test_MarkedForDeleteChild_SavesWhenParentSaves() { //---------------Set up test pack------------------- OrganisationTestBO organisation = OrganisationTestBO.CreateSavedOrganisation(); GetAssociationRelationship(organisation); ContactPersonTestBO contactPerson = ContactPersonTestBO.CreateUnsavedContactPerson(); organisation.ContactPerson = contactPerson; contactPerson.Save(); contactPerson.MarkForDelete(); //---------------Execute Test ---------------------- organisation.Save(); //---------------Test Result ----------------------- BOTestUtils.AssertBOStateIsValidAfterDelete(contactPerson); }
public void Test_CanDeleteParentWithNewChildren() { //--------------- Set up test pack ------------------ ClassDef.ClassDefs.Clear(); OrganisationTestBO.LoadDefaultClassDef(); ContactPersonTestBO.LoadClassDefOrganisationTestBORelationship_MultipleReverse(); OrganisationTestBO organisationTestBO = OrganisationTestBO.CreateSavedOrganisation(); organisationTestBO.ContactPeople.CreateBusinessObject(); //--------------- Test Preconditions ---------------- //--------------- Execute Test ---------------------- organisationTestBO.MarkForDelete(); organisationTestBO.Save(); //--------------- Test Result ----------------------- Assert.IsTrue(organisationTestBO.Status.IsDeleted); }
public void Test_CreatedChild_WhenInsertParentAction_InsertRelationship_SavesWhenParentSaves() { //---------------Set up test pack------------------- OrganisationTestBO organisationTestBO = OrganisationTestBO.CreateSavedOrganisation(); ContactPersonTestBO contactPerson = organisationTestBO.ContactPeople.CreateBusinessObject(); RelationshipDef relationshipDef = (RelationshipDef)organisationTestBO.Relationships["ContactPeople"].RelationshipDef; relationshipDef.RelationshipType = RelationshipType.Association; contactPerson.Surname = TestUtil.GetRandomString(); contactPerson.FirstName = TestUtil.GetRandomString(); //---------------AssertPrecondtion------------------ Assert.AreEqual(InsertParentAction.InsertRelationship, relationshipDef.InsertParentAction); //---------------Execute Test ---------------------- organisationTestBO.Save(); //---------------Test Result ----------------------- Assert.IsFalse(contactPerson.Status.IsDirty); }
public void Test_MarkedForDeleteChild_SavesWhenParentSaves() { //---------------Set up test pack------------------- OrganisationTestBO organisationTestBO = OrganisationTestBO.CreateSavedOrganisation(); ContactPersonTestBO contactPerson = organisationTestBO.ContactPeople.CreateBusinessObject(); RelationshipDef relationshipDef = (RelationshipDef)organisationTestBO.Relationships["ContactPeople"].RelationshipDef; relationshipDef.RelationshipType = RelationshipType.Association; contactPerson.Surname = TestUtil.GetRandomString(); contactPerson.FirstName = TestUtil.GetRandomString(); contactPerson.Save(); contactPerson.MarkForDelete(); //---------------Execute Test ---------------------- organisationTestBO.Save(); //---------------Test Result ----------------------- BOTestUtils.AssertBOStateIsValidAfterDelete(contactPerson); }
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); }
public override void Test_ApplyChangesToBusinessObject_WhenAnItemIsSelectedAndRelatedBusnessObjectWasNull_ShouldUpdateBusinessObjectWithSelectedValue() { //---------------Set up test pack------------------- IComboBox cmbox = CreateComboBox(); BusinessObjectCollection <OrganisationTestBO> boCol; RelationshipComboBoxMapper mapper = GetMapperBoColHasOneItem(cmbox, out boCol); OrganisationTestBO newOrganisation = boCol.CreateBusinessObject(); newOrganisation.Save(); ContactPersonTestBO person = new ContactPersonTestBO(); mapper.BusinessObject = person; //---------------Assert Precondition---------------- Assert.IsNull(person.Organisation); //---------------Execute Test ---------------------- cmbox.SelectedItem = newOrganisation; mapper.ApplyChangesToBusinessObject(); //---------------Test Result ----------------------- Assert.AreSame(newOrganisation, cmbox.SelectedItem); Assert.AreSame(newOrganisation, person.Organisation); }
public void Test_DirtyIfHasMarkForDeleteChildren() { //---------------Set up test pack------------------- OrganisationTestBO organisationTestBO = OrganisationTestBO.CreateSavedOrganisation(); SingleRelationship <ContactPersonTestBO> relationship = GetAggregationRelationshipContactPerson(organisationTestBO, "ContactPerson"); 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 ---------------------- ReflectionUtilities.SetPropertyValue(myBO.Status, "IsDeleted", true); bool isDirty = relationship.IsDirty; //---------------Test Result ----------------------- Assert.IsTrue(isDirty); }
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); }
public void Test_DirtyIfHasMarkForDeleteChildren() { //---------------Set up test pack------------------- OrganisationTestBO organisationTestBO = OrganisationTestBO.CreateSavedOrganisation(); BusinessObjectCollection <ContactPersonTestBO> cpCol; MultipleRelationship <ContactPersonTestBO> relationship = GetAggregationRelationship (organisationTestBO, out cpCol); ContactPersonTestBO myBO = cpCol.CreateBusinessObject(); myBO.Surname = TestUtil.GetRandomString(); myBO.FirstName = TestUtil.GetRandomString(); myBO.Save(); organisationTestBO.Save(); //---------------Assert Precondition---------------- Assert.IsFalse(relationship.IsDirty); //---------------Execute Test ---------------------- cpCol.MarkForDelete(myBO); //---------------Test Result ----------------------- Assert.IsTrue(relationship.IsDirty); }
public void Test_GetDirtyChildren_Removed() { //---------------Set up test pack------------------- OrganisationTestBO organisationTestBO = OrganisationTestBO.CreateSavedOrganisation(); BusinessObjectCollection <ContactPersonTestBO> cpCol; MultipleRelationship <ContactPersonTestBO> relationship = GetAggregationRelationship (organisationTestBO, out cpCol); ContactPersonTestBO contactPerson = cpCol.CreateBusinessObject(); contactPerson.Surname = TestUtil.GetRandomString(); contactPerson.FirstName = TestUtil.GetRandomString(); contactPerson.Save(); organisationTestBO.Save(); cpCol.MarkForDelete(contactPerson); //---------------Execute Test ---------------------- IList <ContactPersonTestBO> dirtyChildren = relationship.GetDirtyChildren(); //---------------Test Result ----------------------- Assert.AreEqual(1, dirtyChildren.Count); Assert.IsTrue(dirtyChildren.Contains(contactPerson)); }
public void Test_ParentDirtyIfHasRemovedChildren() { //---------------Set up test pack------------------- OrganisationTestBO organisationTestBO = OrganisationTestBO.CreateSavedOrganisation(); BusinessObjectCollection <ContactPersonTestBO> cpCol; GetAggregationRelationship(organisationTestBO, out cpCol); ContactPersonTestBO myBO = cpCol.CreateBusinessObject(); myBO.Surname = TestUtil.GetRandomString(); myBO.FirstName = TestUtil.GetRandomString(); myBO.Save(); organisationTestBO.Save(); //---------------Assert Precondition---------------- Assert.IsFalse(organisationTestBO.Status.IsDirty); //---------------Execute Test ---------------------- cpCol.Remove(myBO); bool isDirty = organisationTestBO.Status.IsDirty; //---------------Test Result ----------------------- Assert.IsTrue(isDirty); }
public override void Test_KeyPressStrategy_UpdatesBusinessObject_WhenEnterKeyPressed() { //---------------Set up test pack------------------- ComboBoxWinStub cmbox = new ComboBoxWinStub(); BusinessObjectCollection <OrganisationTestBO> boCol; RelationshipComboBoxMapper mapper = GetMapperBoColHasOneItem(cmbox, out boCol); mapper.MapperStrategy = GetControlFactory().CreateLookupKeyPressMapperStrategy(); OrganisationTestBO newBO = boCol.CreateBusinessObject(); newBO.Save(); OrganisationTestBO organisationTestBO = boCol[0]; ContactPersonTestBO person = CreateCPWithRelatedOrganisation(organisationTestBO); mapper.BusinessObject = person; cmbox.Text = newBO.ToString(); //---------------Assert Precondition---------------- Assert.AreNotSame(newBO, person.Organisation, "For Windows the value should be changed."); //---------------Execute Test ---------------------- cmbox.CallSendKeyBob(); //---------------Test Result ----------------------- Assert.IsInstanceOf(typeof(ComboBoxKeyPressMapperStrategyWin), mapper.MapperStrategy); Assert.AreSame(newBO, person.Organisation, "For Windows the value should be changed."); }
public void Test_UpdateStateAsCommitted_Removed_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; organisationTestBO.Save(); contactPersonTestBO.Organisation = organisationTestBO; contactPersonTestBO.Save(); contactPersonTestBO.Organisation = null; IRelationship relationship = organisationTestBO.Relationships.GetMultiple<ContactPersonTestBO>("ContactPeople"); TransactionalSingleRelationship_Removed tsr = new TransactionalSingleRelationship_Removed(relationship, contactPersonTestBO); //---------------Assert PreConditions--------------- Assert.AreEqual(1, people.RemovedBusinessObjects.Count); Assert.AreEqual(1, people.PersistedBusinessObjects.Count); Assert.IsTrue(singleRelationship.IsRemoved); //---------------Execute Test ---------------------- tsr.UpdateStateAsCommitted(); //---------------Test Result ----------------------- Assert.AreEqual(0, people.RemovedBusinessObjects.Count); Assert.AreEqual(0, people.PersistedBusinessObjects.Count); // Assert.IsFalse(singleRelationship.IsRemoved); //---------------Tear Down ------------------------- }
protected static ContactPersonTestBO CreateRemovedChild_ChildOwnsEdit(OrganisationTestBO organisationTestBO) { ContactPersonTestBO removedChild = ContactPersonTestBO.CreateUnsavedContactPerson(); removedChild.Organisation = organisationTestBO; organisationTestBO.Save(); removedChild.Organisation = null; return removedChild; }