예제 #1
0
        public void AppDescriptor_ctor_AppModel()
        {
            AppModel model = new AppModel();

            model.Add(new UIATestObject());
            model.Add(new UIATestObject());

            model.ProcessName = "TestProcess.exe";
            AppDescriptor descriptor = new AppDescriptor(model);

            Assert.AreEqual("TestProcess.exe", descriptor.ProcessName);

            Assert.AreEqual(2, descriptor.Children.Count);
        }
예제 #2
0
        public static bool SaveToModelFile(TestObjectNurse rootNurse, string filePath)
        {
            AppModel model = new AppModel();

            foreach (TestObjectNurse nurseObject in rootNurse.Children)
            {
                ITestObject testObject = nurseObject.TestObject;

                model.Add(testObject);
            }

            try
            {
                WatcherEnable = false;
                AppModelManager.Save(model, filePath);

                EnsureWatcherCreated(filePath);
                AppEnvironment.CurrentModelPath = filePath;
            }
            finally
            {
                WatcherEnable = true;
            }

            return(true);
        }
예제 #3
0
        public void AppModelManager_HierarchySave()
        {
            UIATestObject d1 = new UIATestObject()
            {
                NodeName    = "rootWindow1",
                ControlName = "rootWindow1_controlName",
                ControlType = ControlType.Window,
                Description = "this is root window"
            };
            UIATestObject d2 = new UIATestObject()
            {
                ControlName = "Panel1",
                ControlType = ControlType.TitleBar
            };
            UIATestObject d3 = new UIATestObject()
            {
                ControlName = "Button",
                ControlType = ControlType.Tree
            };

            /*                    {
             *          {"name", "Button1"},
             *          {"index", "0"},
             *          {"helpText", "Some help Text"}
             *      };
             *
             * d3.AddProperty("name", "Button1");
             * d3.AddProperty("index", "0");
             * d3.AddProperty("helpText", "Some help Text");
             */
            UIATestObject d4 = new UIATestObject()
            {
                ControlType = ControlType.Text
            };

            d4.AddProperty("id", "Text1");

            /*
             * d4.SetItem<UIAPropertyItem>(new UIAPropertyItem()
             * {
             *  Properties = new PropertyEntry()
             *      {
             *          {"id", "Text1"}
             *      }
             * });*/

            d1.AddChild(d2);
            d2.AddChild(d4);

            d2.AddChild(d3);
            AppModel model = new AppModel()
            {
                ProcessName = "calc.exe"
            };

            model.Add(d1);

            AppModelManager.Save(model, "CalcAppModel3.json");

            TestUtility.LaunchNotepad(Path.Combine(System.Environment.CurrentDirectory, "CalcAppModel3.json"));
            //TODO validate the content
        }