public void ModelFileHandler_SaveToModelFile()
        {
            TreeView treeView = new TreeView();

            TestObjectNurse rootNurse = TestObjectNurse.FromTree(treeView);

            AppModel model = ModelFileHandler.LoadModelFile("UnitTestObjectModel1.json", rootNurse);


            TestObjectNurse nurseNode = (TestObjectNurse)rootNurse.FindRecursive(DescriptorKeys.NodeName, "Test Explorer");

            string imageFilePath = AppEnvironment.GetModelResourceFilePath("TestObjectNurseTest.png");

            CacheHandler.EnsureFileDirectoryExists(imageFilePath);

            Snapshot.CaptureImageToFile(new Rectangle(0, 0, 100, 200), imageFilePath);

            Assert.IsTrue(File.Exists(imageFilePath));

            nurseNode.ImageFile = "TestObjectNurseTest.png";

            //remove from root
            nurseNode.Remove();

            AppEnvironment.DumpRecyclingBin(rootNurse);
        }
        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");
            }
        }