Exemplo n.º 1
0
        public void UIATestObject_NoCachedProperties()
        {
            AppModel    model      = AppModelManager.Load("UnitTestObjectModel1.json", ModelLoadLevel.ReplayOnly);
            ITestObject testObject = model.FindFirst(o => o.NodeName == "CachedPropertyTestNode");

            CachedPropertyGroup cachedObject = testObject.GetContext <CachedPropertyGroup>();

            Assert.AreEqual(null, cachedObject);
        }
Exemplo n.º 2
0
        public void UIATestObject_CachedProperties()
        {
            AppModel    model      = AppModelManager.Load("UnitTestObjectModel1.json", ModelLoadLevel.Full);
            ITestObject testObject = model.FindFirst(o => o.NodeName == "CachedPropertyTestNode");

            CachedPropertyGroup cachedObject = testObject.GetContext <CachedPropertyGroup>();

            Assert.AreNotEqual(null, cachedObject);

            Assert.AreEqual("asdfasfdasdfasdf.png", cachedObject.Properties["imageFile"]);
        }
Exemplo n.º 3
0
        public void AppModelManager_LoadFull()
        {
            AppModel       model;
            ModelLoadLevel loadLevel = ModelLoadLevel.Full;

            model = AppModelManager.Load("CalcAppModel.json", loadLevel);
            UIATestObject testObject = (UIATestObject)model.FindFirst(DescriptorKeys.NodeName, "result");

            Assert.AreNotEqual(null, testObject);
            UIACondition condition = testObject.GetContext <UIACondition>();

            //TODO validate the content
        }
Exemplo n.º 4
0
        public void AppModelManager_LoadReplayOnly()
        {
            AppModel model;

            //default is replay only
            model = AppModelManager.Load("CalcAppModel.json");
            ITestObject resultObject = model.FindFirst(DescriptorKeys.NodeName, "result");

            Assert.AreNotEqual(null, resultObject);

            Assert.IsNotNull(model.ModelFile);

            Assert.IsTrue(model.ModelFile.FilePath.EndsWith("CalcAppModel.json", StringComparison.InvariantCultureIgnoreCase));
            //TODO: do some more validation on the content
        }
        public void VirtualControlHelper_LoadVirtualControls()
        {
            string   appModelPath = "UnitTestVirtualControl.json";
            AppModel virtualModel = AppModelManager.Load(appModelPath);

            Assert.AreEqual(1, virtualModel.Items.Count);

            ITestObject testObject = virtualModel.Items[0];

            Assert.AreEqual(3, testObject.Children.Count);

            VirtualTestObject[] controls = VirtualControlHelper.GetVirtualControls(testObject);

            VirtualControlHelper.DumpVirtualControls(controls);
        }
Exemplo n.º 6
0
        public static AppModel LoadModelFile(string appModelPath, TestObjectNurse rootNurse)
        {
            _treeObjects = rootNurse.TreeView;

            AppModel model = AppModelManager.Load(appModelPath, ModelLoadLevel.Full);

            TestObjectToTreeNode(model.Items, rootNurse);

            AppEnvironment.CurrentModelPath = appModelPath;

            OnFileLoaded(appModelPath);

            AppEnvironment.CurrentModelPath = appModelPath;
            EnsureWatcherCreated(AppEnvironment.CurrentModelPath);

            return(model);
        }
Exemplo n.º 7
0
        public void AppModelManager_LoadFileMissing()
        {
            AppModel model;

            try
            {
                model = AppModelManager.Load("SomeFileDoesntExist.json");

                Assert.IsNull(model.ModelFile);
            }
            catch (FileNotFoundException ex)
            {
                Assert.IsTrue(true);
                return;
            }
            Assert.Fail("Should throw FileNotFoundException if file doesn't exist");
        }
Exemplo n.º 8
0
        public static UIAModel GetManager(string pathToModel)
        {
            AppModel model = AppModelManager.Load(pathToModel);

            return(new UIAModel(model));
        }