예제 #1
0
        public void TestGetReverseRelationship()
        {
            //---------------Set up test pack-------------------
            OrganisationTestBO.LoadDefaultClassDef_WithTwoRelationshipsToContactPerson();
            IClassDef cpClassDef = ContactPersonTestBO.LoadClassDefOrganisationTestBORelationship_MultipleReverse();

            cpClassDef.RelationshipDefCol["Organisation"].ReverseRelationshipName = "OtherContactPeople";

            OrganisationTestBO  organisation  = OrganisationTestBO.CreateSavedOrganisation();
            ContactPersonTestBO contactPerson = ContactPersonTestBO.CreateUnsavedContactPerson();

            SingleRelationship <OrganisationTestBO> organisationRel =
                contactPerson.Relationships.GetSingle <OrganisationTestBO>("Organisation");
            MultipleRelationship <ContactPersonTestBO> contactPeopleRel =
                organisation.Relationships.GetMultiple <ContactPersonTestBO>("OtherContactPeople");

            //---------------Execute Test ----------------------
            IRelationship reverseRelationship = organisationRel.GetReverseRelationship(organisation);

            //---------------Test Result -----------------------
            Assert.AreSame(contactPeopleRel, reverseRelationship);
        }