CreateValidBusinessObject() 공개 메소드

Creates a business object with all of its compulsory properties and Relationships set to Valid values.
public CreateValidBusinessObject ( ) : IBusinessObject
리턴 IBusinessObject
 public void Test_CreateValidBusinessObject_ShouldReturnBOWithCompulsoryPropsPopulated()
 {
     //---------------Set up test pack-------------------
     //---------------Assert Precondition----------------
     var factory = new BOTestFactory(typeof(FakeBO));
     //---------------Execute Test ----------------------
     var businessObject = factory.CreateValidBusinessObject() as FakeBO;
     //---------------Test Result -----------------------
     Assert.IsNotNull(businessObject);
     Assert.IsInstanceOf<FakeBO>(businessObject);
     Assert.IsNotNull(businessObject.CompulsoryString);
 }
 public void Test_SetDefaultValue_WhenRelationship_ShouldCreateWithValueSet()
 {
     //---------------Set up test pack-------------------
     var relatedBO = new RelatedFakeBo();
     var boWithRelFactory = new BOTestFactory(typeof(FakeBOWithRelationship));
     //---------------Assert Precondition----------------
     //---------------Execute Test ----------------------
     boWithRelFactory.SetValueFor("SingleRelationship", relatedBO);
     var boWithRelationship = boWithRelFactory.CreateValidBusinessObject() as FakeBOWithRelationship;
     //---------------Test Result -----------------------
     Assert.IsNotNull(boWithRelationship);
     Assert.AreSame(relatedBO, boWithRelationship.SingleRelationship);
 }
 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);
 }