/// <summary> /// Sets the value of one of the type's private properties /// </summary> public static ISingleObjectBuilder <T> With <T, TProperty>(this ISingleObjectBuilder <T> objectBuilder, Expression <Func <T, TProperty> > property, TProperty value) { var member = ((MemberExpression)property.Body).Member; if (member is FieldInfo) { return(objectBuilder.Do(load => ((FieldInfo)member).SetValue(load, value))); } else { return(objectBuilder.Do(load => ((PropertyInfo)member).SetValue(load, value, null))); } }
public void ShouldBeAbleToUseAndToCallFunction() { objectBuilder.Do(action).Returns(objectBuilder); SingleObjectBuilderExtensions.And(objectBuilder, action); }
public ISingleObjectBuilder <T> Do(Action <T> action) { return(_builderInstance.Do(action)); }