public void one_in_one_out() { MethodInfo method = type.GetMethod("OneInOneOut"); var func = FuncBuilder.ToFunc(type, method).ShouldBeOfType <Func <PropertyTarget, int, string> >(); func(new PropertyTarget(), 123).ShouldEqual("123"); }
private ValueDependency createLambda() { object lambda = HasOutput ? FuncBuilder.ToFunc(HandlerType, Method) : FuncBuilder.ToAction(HandlerType, Method); return(new ValueDependency(lambda.GetType(), lambda)); }
public void zero_in_one_out() { MethodInfo method = type.GetMethod("ZeroInOneOut"); var func = FuncBuilder.ToFunc(type, method).ShouldBeOfType <Func <PropertyTarget, string> >(); var target = new PropertyTarget(); func(target).ShouldEqual(target.ZeroInOneOut()); }
protected override IConfiguredInstance buildInstance() { Validate(); var instance = new ConfiguredInstance(determineHandlerType()); var lambda = HasOutput ? FuncBuilder.ToFunc(HandlerType, Method) : FuncBuilder.ToAction(HandlerType, Method); instance.Dependencies.Add(lambda.GetType(), lambda); return(instance); }