Ejemplo n.º 1
0
        public void LoadTestFromXML()
        {
            //set workspace so that it writes units to disc, otherwise files would not be written to disc,
            //so the persistence the units would not be persistent after resetting the workspace
            TestWorkspace.WriteUnitsToDisc = true;

            TestObject obj = new TestObject();

            obj.Value = "value";

            string tmp_unitname = "testobject";

            //string tmpDataPath = Path.Combine(TmpDataDir, TestWorkspace.CurrentGroupId.ToString() + "." + tmp_unitname + ".xml");
            string tmpDataPath = Path.Combine(TmpDataDir, tmp_unitname + ".xml");

            WorkspaceUnit tmpUnit = TestWorkspace.CreateWorkspaceUnit(tmp_unitname);

            tmpUnit.Data = obj;

            // Reset the workspace - this will cause it to realize that
            // the workspace unit exists, even though it's not loaded yet.
            ResetWorkspace();

            TestObject obj2 = (TestObject)TestWorkspace.Load(tmp_unitname);

            Assert.AreEqual(obj, obj2);
        }