Ejemplo n.º 1
0
        public static AppModel Load(string filePath, ModelLoadLevel level = ModelLoadLevel.ReplayOnly)
        {
            if (!File.Exists(filePath))
            {
                throw new FileNotFoundException(string.Format("File {0} does not exist", filePath));
            }
            string content = Utility.ReadFileContent(filePath);

            AppDescriptor appDescriptor = JsonUtil.DeserializeObject <AppDescriptor>(content, level);

            AppModel model = appDescriptor.GetObject();

            model.ModelFile = new AppModelFile(filePath);

            return(model);
        }
Ejemplo n.º 2
0
        public void AppDescriptor_GetObject()
        {
            AppDescriptor appDescriptor = new AppDescriptor();

            appDescriptor.ProcessName = "TestProcess.exe";
            appDescriptor.Children.Add(new ObjectDescriptor()
            {
                Type = NodeType.UIAControl
            });
            appDescriptor.Children.Add(new ObjectDescriptor()
            {
                Type = NodeType.UIAControl
            });

            AppModel appModel = appDescriptor.GetObject();

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

            Assert.AreEqual(2, appModel.AllItems.Count);
        }