예제 #1
0
        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");
        }
예제 #2
0
        private ValueDependency createLambda()
        {
            object lambda = HasOutput
                                ? FuncBuilder.ToFunc(HandlerType, Method)
                                : FuncBuilder.ToAction(HandlerType, Method);

            return(new ValueDependency(lambda.GetType(), lambda));
        }
예제 #3
0
        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());
        }
예제 #4
0
        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);
        }