Exemple #1
0
        private bool CanExecute <T>(int argsCount) where T : class
        {
            Type type = typeof(T);

            List <MethodInfo> methods = CClassUtils.ListInstanceMethods(type, delegate(MethodInfo method)
            {
                return(method.Name.Equals("Execute"));
            });

            Assert.AreEqual(1, methods.Count);

            return(CCommandUtils.CanInvokeMethodWithArgsCount(methods[0], argsCount));
        }
Exemple #2
0
        private MethodInfo resolveExecuteMethod(String[] args)
        {
            if (executeMethods == null)
            {
                executeMethods = resolveExecuteMethods();
            }

            MethodInfo method = null;

            foreach (MethodInfo m in executeMethods)
            {
                if (CCommandUtils.CanInvokeMethodWithArgsCount(m, args.Length))
                {
                    if (method != null) // multiple methods found
                    {
                        return(null);
                    }

                    method = m;
                }
            }

            return(method);
        }