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_GetValidValue_WithBO_WhenIsRelationship_ShouldRetValidValue() { //---------------Set up test pack------------------- const string relName = "NonCompulsoryRelationship"; Type boType = typeof(FakeBO); var relationship = new BOTestFactory(boType).CreateValidBusinessObject().Relationships[relName] as ISingleRelationship; var factory = new BOTestFactory(boType); //---------------Assert Precondition---------------- Assert.IsNotNull(relationship); Assert.IsNull(relationship.GetRelatedObject()); //---------------Execute Test ---------------------- object validValue = factory.GetValidValue(new FakeBO(),relName); //---------------Test Result ----------------------- Assert.IsNotNull(validValue); Assert.IsInstanceOf<IBusinessObject>(validValue); var validRelationshipValue = validValue as IBusinessObject; Assert.IsNotNull(validRelationshipValue); Assert.AreSame(validRelationshipValue.ClassDef, relationship.RelatedObjectClassDef); }