Ejemplo n.º 1
0
        /// <summary>
        /// Invokes the underlaying method with the provided defaults and given additional parameters
        /// </summary>
        /// <param name="additionalParameters">the additional parameters that are supported by the method</param>
        /// <returns>the result of the invokation of the method</returns>
        public object Invoke(object[] additionalParameters, out bool success)
        {
            success = false;
            object[] args = (from t in defaultParameters select(!(t is FixtureMapper))?t:((FixtureMapper)t).Value).ToArray();
            if (additionalParameters != null && additionalParameters.Length != 0)
            {
                List <object> l = new List <object>();
                l.AddRange(defaultParameters);
                l.AddRange(additionalParameters);
                args = l.ToArray();
            }

            object[] callArgs;
            var      callMethod = MethodHelper.FindMethodFromArray(true, new[] { dlg }, MethodHelper.GetTypeArray(args), args, out callArgs);

            if (callMethod != null)
            {
                success = true;
                return(callMethod.MethodInfo.Invoke(target, args));
            }

            return(null);
        }