public void Test_CreateRevRelationship_WhenIsOneToOne_ShouldCreateSingleRevRel() { //---------------Set up test pack------------------- var singleRelationshipDef = new FakeSingleRelationshipDef(); singleRelationshipDef.SetAsOneToOne(); IClassDef cDefWith121 = typeof(FakeBoNoProps).MapClass(); ClassDefCol classDefCol = new ClassDefCol { cDefWith121 }; //---------------Assert Precondition---------------- Assert.IsTrue(singleRelationshipDef.IsOneToOne); //---------------Execute Test ---------------------- IRelationshipDef reverseRelDef = AllClassesAutoMapper.CreateReverseRelationship(classDefCol, cDefWith121, singleRelationshipDef); //---------------Test Result ----------------------- Assert.AreEqual(singleRelationshipDef.ReverseRelationshipName, reverseRelDef.RelationshipName); Assert.AreEqual(singleRelationshipDef.RelationshipName, reverseRelDef.ReverseRelationshipName); Assert.IsInstanceOf(typeof(SingleRelationshipDef), reverseRelDef); Assert.AreEqual(RelationshipType.Association, reverseRelDef.RelationshipType); Assert.AreEqual(DeleteParentAction.DoNothing, reverseRelDef.DeleteParentAction); Assert.IsTrue(reverseRelDef.OwningBOHasForeignKey); }
public void Test_CreateRevRelationship_WhenIsOneToOne_ShouldCreateSingleRevRel() { //---------------Set up test pack------------------- var singleRelationshipDef = new FakeSingleRelationshipDef(); singleRelationshipDef.SetAsOneToOne(); IClassDef cDefWith121 = typeof(FakeBoNoProps).MapClass(); ClassDefCol classDefCol = new ClassDefCol { cDefWith121}; //---------------Assert Precondition---------------- Assert.IsTrue(singleRelationshipDef.IsOneToOne); //---------------Execute Test ---------------------- IRelationshipDef reverseRelDef = AllClassesAutoMapper.CreateReverseRelationship(classDefCol, cDefWith121, singleRelationshipDef); //---------------Test Result ----------------------- Assert.AreEqual(singleRelationshipDef.ReverseRelationshipName, reverseRelDef.RelationshipName); Assert.AreEqual(singleRelationshipDef.RelationshipName, reverseRelDef.ReverseRelationshipName); Assert.IsInstanceOf(typeof(SingleRelationshipDef), reverseRelDef); Assert.AreEqual(RelationshipType.Association, reverseRelDef.RelationshipType); Assert.AreEqual(DeleteParentAction.DoNothing, reverseRelDef.DeleteParentAction); Assert.IsTrue(reverseRelDef.OwningBOHasForeignKey); }