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);
        }
        private ActionStep ConvertToStep(AutomationStep stepData)
        {
            ActionStep step = new ActionStep();

            step.Name        = stepData.Name;
            step.Description = stepData.Description;

            return(step);
        }
Exemplo n.º 3
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);
        }