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); }
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); }