Exemplo n.º 1
0
        public static WebAutomationConfig Load()
        {
            if (actionConfig == null)
            {
                actionConfig = XmlSerializerHelper.LoadFromXml<WebAutomationConfig>("data.config");
            }

            return actionConfig;
        }
        public static WebAutomationConfig Load()
        {
            if (actionConfig == null)
            {
                actionConfig = XmlSerializerHelper.LoadFromXml <WebAutomationConfig>("data.config");
            }

            return(actionConfig);
        }
Exemplo n.º 3
0
        public static WebAutomationConfig Load(string file)
        {
            if (actionConfig == null)
            {
                actionConfig = XmlSerializerHelper.LoadFromXml<WebAutomationConfig>(file);
            }

            return actionConfig;
        }
        public static WebAutomationConfig Load(string file)
        {
            if (actionConfig == null)
            {
                actionConfig = XmlSerializerHelper.LoadFromXml <WebAutomationConfig>(file);
            }

            return(actionConfig);
        }
        public void Test_LoadConfig()
        {
            AutomationAction action = new AutomationAction();
            action.Type = "Mouse";

            AutomationAction childAction = new AutomationAction();
            childAction.Type = "Mouse";
            action.AddChild(childAction);

            AutomationStep step = new AutomationStep();
            step.Name = "First";
            step.Description = "test";
            step.Add(action);

            WebAutomationConfig config = new WebAutomationConfig();
            config.Add(step);

            AutomationManagement manager = new AutomationManagement();
            manager.LoadConfig(config);
        }
Exemplo n.º 6
0
        public void Test_ConfigurationSerialize()
        {
            WebAutomationConfig config = new WebAutomationConfig();
            config.Name = "Test1";
            config.Version = "0.1";

            AutomationStep step = new AutomationStep();
            step.Name = "aaa";
            step.ActionList = new System.Collections.Generic.List<AutomationAction>();

            config.Add(step);

            AutomationAction action = new AutomationAction();
            action.Type = "Wait";

            AutomationActionAttribute attr = new AutomationActionAttribute();
            attr.Name = "name";
            attr.Value = "value";
            action.Add(attr);

            AutomationAction childAction = new AutomationAction();
            childAction.Type = "Click";
            childAction.Add(attr);

            action.AddChild(childAction);
            step.Add(action);

            WebAutomationConfig.Save(config);

            WebAutomationConfig loadConfig = WebAutomationConfig.Load();

            Assert.IsNotNull(loadConfig);
            Assert.AreEqual(loadConfig.Name, config.Name);
            Assert.AreEqual(loadConfig.StepList.Count, config.StepList.Count);
            Assert.AreEqual(loadConfig.StepList[0].Name, config.StepList[0].Name);
        }
Exemplo n.º 7
0
 public static void Save(WebAutomationConfig config)
 {
     XmlSerializerHelper.Serialize<WebAutomationConfig>("data.config", config);
 }
Exemplo n.º 8
0
        public void LoadConfig(WebAutomationConfig config)
        {
            if (config == null)
            {
                throw new ArgumentNullException("config must not be null");
            }
            if (config.StepList == null)
            {
                return;
            }

            // conver to
            actionStepList = new List<ActionStep>();

            foreach (AutomationStep stepData in config.StepList)
            {
                if (!stepData.Enabled)
                {
                    continue;
                }

                ActionStep step = ConvertToStep(stepData);
                if (stepData.ActionList != null)
                {
                    foreach (AutomationAction actionData in stepData.ActionList)
                    {
                        if (!actionData.Enabled)
                        {
                            continue;
                        }
                        IAction action = ConvertToAction(actionData);
                        if (step.ActionList == null)
                        {
                            step.ActionList = new List<IAction>();
                        }
                        step.ActionList.Add(action);

                        LoadChildAction(action, actionData);
                        LoadConditionAction(action, actionData);
                    }
                }

                actionStepList.Add(step);
            }
        }
 public static void Save(WebAutomationConfig config)
 {
     XmlSerializerHelper.Serialize <WebAutomationConfig>("data.config", config);
 }