Ejemplo n.º 1
0
        public override ActionResult Execute(ISpecialExecutionTaskTestAction testAction)
        {
            var        action     = testAction as SpecialExecutionTaskTestAction;
            var        module     = action.TCItem.GetModule();
            XModule    xMod       = module as XModule;
            var        xParams    = xMod.GetXParams();
            ModuleType moduleType = ModuleType.Method;
            //if (!Enum.TryParse(xParams.Single(x => x.Name.ToLower() == "type").Value, out moduleType))
            //{
            //    throw new InvalidOperationException("Invalid value in 'Type' Technical Parameter");
            //}

            ReflectionConfig config = new ReflectionConfig
            {
                ClassName   = xParams.Single(x => x.Name.ToLower() == "classname").Value,
                LibraryFile = xParams.Single(x => x.Name.ToLower() == "libraryfile").Value,
                MethodName  = xParams.Single(x => x.Name.ToLower() == "methodname").Value
            };

            var          classObject = ActivateObject(config);
            ActionResult result      = null;

            switch (moduleType)
            {
            case ModuleType.Class:
                result = ExecuteClass(action, classObject);
                break;

            case ModuleType.Method:
                result = ExecuteMethod(action, classObject, config);
                break;
            }
            return(result);
        }