public static void Reset() { _modelFile = null; _currentDirectory = null; CurrentModelPath = SpySettings.LastModelPath; }
private static void CreatePicture(AppModelFile modelFile) { Snapshot.CaptureImageToFile(new Rectangle(0, 0, 100, 200), modelFile.GetResourceFilePath("TestObjectNurseTest.png")); Snapshot.CaptureImageToFile(new Rectangle(0, 0, 100, 200), modelFile.GetResourceFilePath("TestObjectNurseTest1.png")); }
public void AppModelFile_Test() { AppModelFile modelFile = new AppModelFile("UnitTestObjectModel1.json"); Assert.IsTrue(Path.IsPathRooted(modelFile.FilePath)); Assert.IsTrue(File.Exists(modelFile.FilePath)); Assert.IsTrue(modelFile.ResourceFolderPath.EndsWith("files")); Debug.WriteLine(modelFile.FolderPath); }
public void AppEnvironment_DumpRecyclingBin() { string modelFilePath = "TempModelFile.json"; try { AppEnvironment.CurrentModelFile = AppModelFile.Create(modelFilePath); //init test objects UIATestObject _parentTestObject = new UIATestObject(); UIATestObject _childTestObject = new UIATestObject(); UIATestObject childTestObject2 = new UIATestObject(); VirtualTestObject _grandChildTestObject = new VirtualTestObject(); CreatePicture(AppEnvironment.CurrentModelFile); //initialize nurse objects TestObjectNurse parentNurse = new TestObjectNurse(_parentTestObject); TestObjectNurse childNurse = parentNurse.AddChild(_childTestObject) as TestObjectNurse; TestObjectNurse childNurse2 = parentNurse.AddChild(childTestObject2) as TestObjectNurse; TestObjectNurse grandChildNurse = childNurse.AddChild(_grandChildTestObject) as TestObjectNurse; string imagePath1 = AppEnvironment.GetModelResourceFilePath("TestObjectNurseTest.png"); string imagePath2 = AppEnvironment.GetModelResourceFilePath("TestObjectNurseTest1.png"); Assert.IsTrue(File.Exists(imagePath1)); Assert.IsTrue(File.Exists(imagePath2)); childNurse2.ImageFile = "TestObjectNurseTest.png"; grandChildNurse.ImageFile = "TestObjectNurseTest1.png"; parentNurse.RemoveChild(childNurse); Assert.IsTrue(File.Exists(imagePath1)); parentNurse.RemoveChild(childNurse2); Assert.IsTrue(File.Exists(imagePath2)); AppEnvironment.DumpRecyclingBin(parentNurse); Assert.IsFalse(File.Exists(imagePath1)); Assert.IsFalse(File.Exists(imagePath2)); } finally { File.Delete("TestObjectNurseTest.png"); File.Delete("TestObjectNurseTest1.png"); } }