SetValueFor() 공개 메소드

Sets the propertyValue for the method Idenfied by the propertyName. This ensures that when the CreateValidBusinessObject or BOTestFactory.UpdateCompulsoryProperties or GetValidPropValue(Habanero.Base.IBOProp) and the GetValidRelationshipValue for this Property this value is always used
public SetValueFor ( string propertyName, object propertyValue ) : void
propertyName string
propertyValue object
리턴 void
        public void Test_SetRelationship_WhenHasValue_AndValueRegistered_ShouldSetToRegisteredValue()
        {
            //---------------Set up test pack-------------------
            var bo = new BOTestFactory(typeof(FakeBO)).CreateValidBusinessObject();
            var relationship = bo.Relationships["NonCompulsoryRelationship"] as ISingleRelationship;

            var factory = new BOTestFactory<FakeBO>();
            factory.SetRelationshipToValidValue(relationship);
            var expectedRelationshipValue = new RelatedFakeBo();
            //---------------Assert Precondition----------------
            Assert.IsNotNull(relationship);
            var origionalBO = relationship.GetRelatedObject();
            Assert.IsNotNull(relationship.GetRelatedObject());
            //---------------Execute Test ----------------------
            factory.SetValueFor(fakeBO => fakeBO.NonCompulsoryRelationship, expectedRelationshipValue);
            factory.SetRelationshipToValidValue(relationship);
            var actualRelatedObject = relationship.GetRelatedObject();
            //---------------Test Result -----------------------
            Assert.IsNotNull(actualRelatedObject);
            Assert.AreSame(expectedRelationshipValue, actualRelatedObject);
        }
 public void Test_SetDefaultValue_WhenProperty_ShouldReturnSetValue()
 {
     //---------------Set up test pack-------------------
     const string expectedPropValue = "SomeValue";
     const string propName = "SomeProp";
     var boWithRelFactory = new BOTestFactory(typeof(FakeBO));
     //---------------Assert Precondition----------------
     //---------------Execute Test ----------------------
     boWithRelFactory.SetValueFor(propName, expectedPropValue);
     var actualValue = boWithRelFactory.GetValidPropValue(typeof(FakeBOWithRelationship), propName);
     //---------------Test Result -----------------------
     Assert.AreSame(expectedPropValue, actualValue);
 }
 public static BOTestFactory <T> WithValueFor <T, TPropType>(this BOTestFactory <T> factory, string propertyName) where T : class, IBusinessObject
 {
     factory.SetValueFor(propertyName);
     return(factory);
 }
 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 static BOTestFactory <T> WithValueFor <T, TPropType>(this BOTestFactory <T> factory, Expression <Func <T, TPropType> > expression) where T : class, IBusinessObject
 {
     factory.SetValueFor(expression);
     return(factory);
 }