GetValidRelationshipValue() 공개 메소드

Returns a Valid Relationship Value for the relationship relationshipDef
public GetValidRelationshipValue ( ISingleValueDef relationshipDef ) : IBusinessObject
relationshipDef ISingleValueDef
리턴 IBusinessObject
 public void Test_GetValidRelationshipValue_ShouldCreateRelatedBO()
 {
     //---------------Set up test pack-------------------
     var boTestFactory = new BOTestFactory(typeof(FakeBO));
     var businessObject = (FakeBO) boTestFactory.CreateValidBusinessObject();
     var relationship = businessObject.Relationships["NonCompulsoryRelationship"] as ISingleRelationship;
     //---------------Assert Precondition----------------
     Assert.IsNotNull(relationship);
     Assert.IsNull(relationship.GetRelatedObject());
     //---------------Execute Test ----------------------
     IRelationshipDef relationshipDef = relationship.RelationshipDef;
     IBusinessObject validRelationshipValue = boTestFactory.GetValidRelationshipValue(relationshipDef as ISingleValueDef);
     //---------------Test Result -----------------------
     Assert.IsNotNull(validRelationshipValue);
     Assert.IsTrue(validRelationshipValue.Status.IsNew);
 }
 public void Test_GetValidRelationshipValue_ShouldRetValidValue()
 {
     //---------------Set up test pack-------------------
     var relationship = new BOTestFactory(typeof(FakeBO)).CreateValidBusinessObject().Relationships["NonCompulsoryRelationship"] as ISingleRelationship;
     var factory = new BOTestFactory(typeof(FakeBO));
     //---------------Assert Precondition----------------
     Assert.IsNotNull(relationship);
     Assert.IsNull(relationship.GetRelatedObject());
     //---------------Execute Test ----------------------
     var validRelationshipValue = factory.GetValidRelationshipValue(relationship.RelationshipDef as ISingleValueDef);
     //---------------Test Result -----------------------
     Assert.IsNotNull(validRelationshipValue);
     Assert.AreSame(validRelationshipValue.ClassDef, relationship.RelatedObjectClassDef);
 }