public void Test_TestCreatedChildBO_ParentSet() { //Test that the parent business object is set for a // child bo that is created by the collection //---------------Set up test pack------------------- ClassDef.ClassDefs.Clear(); BORegistry.DataAccessor = new DataAccessorInMemory(); ContactPersonTestBO.LoadClassDefWithAddresBOsRelationship_AddressReverseRelationshipConfigured(); ContactPersonTestBO contactPersonTestBO = ContactPersonTestBO.CreateSavedContactPersonNoAddresses(); //---------------Assert Precondition---------------- //---------------Execute Test ---------------------- AddressTestBO address = contactPersonTestBO.AddressTestBOs.CreateBusinessObject(); //---------------Test Result ----------------------- Assert.IsNotNull(address.ContactPersonTestBO); Assert.IsNotNull(address.ContactPersonID); }
public void Test_TestAddNewChildBO_ParentNotPersisted_ParentSet() { //Test that the parent business object is set for a // child bo that is created by the collection //---------------Set up test pack------------------- ClassDef.ClassDefs.Clear(); BORegistry.DataAccessor = new DataAccessorInMemory(); ContactPersonTestBO.LoadClassDefWithAddresBOsRelationship_AddressReverseRelationshipConfigured(); ContactPersonTestBO contactPersonTestBO = ContactPersonTestBO.CreateUnsavedContactPerson(TestUtil.GetRandomString(), TestUtil.GetRandomString()); AddressTestBO address = new AddressTestBO(); //---------------Assert Precondition---------------- //---------------Execute Test ---------------------- contactPersonTestBO.AddressTestBOs.Add(address); //---------------Test Result ----------------------- Assert.IsNotNull(address.ContactPersonID); Assert.IsNotNull(address.ContactPersonTestBO); }
public void Test_TestGetReverseRelationship() { //This is probably a temporary test as this method is hacked together due // to the fact that reverse relationships are not currently defined In Habanero. //---------------Set up test pack------------------- ClassDef.ClassDefs.Clear(); BORegistry.DataAccessor = new DataAccessorInMemory(); ContactPersonTestBO.LoadClassDefWithAddresBOsRelationship_AddressReverseRelationshipConfigured(); ContactPersonTestBO contactPersonTestBO = ContactPersonTestBO.CreateUnsavedContactPerson(TestUtil.GetRandomString(), TestUtil.GetRandomString()); //---------------Assert Precondition---------------- //---------------Execute Test ---------------------- AddressTestBO address = contactPersonTestBO.AddressTestBOs.CreateBusinessObject(); //---------------Test Result ----------------------- IRelationship relationship = contactPersonTestBO.AddressTestBOs.GetReverseRelationship(address); Assert.IsNotNull(relationship); Assert.AreSame(address.Relationships["ContactPersonTestBO"], relationship); }