public void TestRealConfig_SaveWithFiles() { ConfMgmt.Generate(GlobalVar.RealConfPath); var orig = ConfMgmt.Root; FileOp.RmDir(GlobalVar.ResultPath); FileOp.CopyDir(GlobalVar.RealConfPath, GlobalVar.ResultPath); ConfMgmt.Clear(); ConfMgmt.Generate(GlobalVar.ResultPath); ConfMgmt.Save(); ConfMgmt.Generate(GlobalVar.ResultPath); var copy = ConfMgmt.Root; //foreach (var kv in orig) //{ // ConfTree tree = null; // foreach (var kv2 in copy) // { // if (kv2.Key.Contains(Path.GetFileName(kv.Key))) // { // tree = copy[kv2.Key]; // } // } // Assert.IsTrue(kv.Value.Equals(tree)); //} }
public void TestConfMgmt_Modify() { ConfMgmt.Generate($@"{GlobalVar.SamplePath}/ConfigFiles"); var conf = ConfMgmt.GetTree("SystemSetting"); conf["DutsCount"] = "0"; ConfMgmt.Save(); conf = Builder.Xml.Generate($@"{GlobalVar.SamplePath}/ConfigFiles/Configs/SystemSetting.xml"); JbAssert.Equal(conf["DutsCount"], "0"); //restore ConfMgmt.Clear(); ConfMgmt.Generate($@"{GlobalVar.SamplePath}/ConfigFiles"); conf = ConfMgmt.GetTree("SystemSetting"); conf["DutsCount"] = "40"; ConfMgmt.Save(); conf = Builder.Xml.Generate($@"{GlobalVar.SamplePath}/ConfigFiles/Configs/SystemSetting.xml"); JbAssert.Equal(conf["DutsCount"], "40"); }
public static void Initialize() { ConfMgmt.Clear(); }
public static void Initialize(ConfMgmt conf) { conf.Clear(); }