Exemplo n.º 1
0
        public void SiblingRelationshipAutogenerates()
        {
            oms.BeginTransaction();

            InstanceHandle ihClass = oms.GetInstance(KnownInstanceGuids.Classes.Class);
            InstanceHandle ihZzz   = oms.CreateClass(GUID_ZZZ);

            oms.CommitTransaction();
            oms.BeginTransaction();

            InstanceHandle ihZzzInst1 = oms.CreateInstance(ihZzz);

            InstanceHandle ihClass_has_ZZZ = oms.CreateRelationshipInstance(ihClass, "has", ihZzz, GUID_CLASS_HAS_ZZZ);
            InstanceHandle ihZZZ_for_Class = oms.CreateRelationshipInstance(ihZzz, "for", ihClass, GUID_ZZZ_FOR_CLASS);

            oms.CommitTransaction();
            oms.BeginTransaction();
            oms.CreateRelationship(ihClass_has_ZZZ, oms.GetInstance(KnownRelationshipGuids.Relationship__has_sibling__Relationship), ihZZZ_for_Class);
            oms.CommitTransaction();

            oms.BeginTransaction();
            oms.CreateRelationship(ihClass, ihClass_has_ZZZ, ihZzzInst1);
            oms.CommitTransaction();

            InstanceHandle ihZzzClass = oms.GetRelatedInstance(ihZzzInst1, ihZZZ_for_Class);

            Assert.AreEqual(ihClass, ihZzzClass);
        }