public void TestBuild_Xml_Attribute_Save() { ConfTree conf = Builder.Xml.Generate($@"{GlobalVar.SamplePath}/Attribute.xml"); Debug.WriteLine(conf.ToString()); Builder.Xml.Save(conf, $@"{GlobalVar.ResultPath}/Attribute.xml"); }
public void TestConfTree_Clone_Modify_Save() { ConfTree conf1 = Builder.Generate(new Dictionary <string, string> { { "Item1", "Value1" }, { "Item2", "Value2" }, }, "DictionaryConf"); Builder.Xml.Save(conf1, $"{GlobalVar.ResultPath}/Conf.xml"); GlobalVar.Log.Debug(conf1.ShowAll()); ConfTree conf2 = conf1.Clone("new") as ConfTree; Builder.Xml.Save(conf2 as ConfTree); conf1["Item1"] = "Value3"; Builder.Xml.Save(conf1 as ConfTree); Debug.WriteLine(conf2.ToString()); conf2["Item2"] = "Value4"; Builder.Xml.Save(conf2 as ConfTree); ConfTree readback = Builder.Xml.Generate($"{GlobalVar.ResultPath}/Conf.xml"); Debug.WriteLine(readback.ToString()); JbAssert.Equal(readback["Default:Item1"], "Value3"); JbAssert.Equal(readback["Default:Item2"], "Value2"); JbAssert.Equal(readback["new:Item1"], "Value1"); JbAssert.Equal(readback["new:Item2"], "Value4"); }
public void TestConfTree_Clone_SaveToDiffFile() { ConfTree conf1 = Builder.Generate(new Dictionary <string, string> { { "Item1", "Value1" }, { "Item2", "Value2" }, }, "DictionaryConf"); Assert.IsTrue(conf1.XmlDoc == null); Builder.Xml.Save(conf1, $"{GlobalVar.ResultPath}/Conf1.xml"); JbAssert.PathEqual((conf1.XmlDoc as XmlDocument).BaseURI, $"file:///{GlobalVar.ResultPath}/Conf1.xml"); var conf2 = conf1.Clone("new"); Debug.WriteLine(conf2.ToString()); Assert.IsTrue((conf2 as ConfTree).XmlDoc == null); Builder.Xml.Save(conf2 as ConfTree, $"{GlobalVar.ResultPath}/Conf2.xml"); JbAssert.PathEqual(((conf2 as ConfTree).XmlDoc as XmlDocument).BaseURI, $"file:///{GlobalVar.ResultPath}/Conf2.xml"); ConfTree conf = new ConfTree("DictionaryConf"); conf.Add(conf1); conf.Add(conf2); Debug.WriteLine(conf.ToString()); Builder.Xml.Save(conf as ConfTree, $"{GlobalVar.ResultPath}/Conf.xml"); JbAssert.PathEqual(((conf as ConfTree).XmlDoc as XmlDocument).BaseURI, $"file:///{GlobalVar.ResultPath}/Conf.xml"); var conf4 = conf.Clone("conf4"); ConfTree super = new ConfTree("SuperConf"); super.Add(conf); super.Add(conf4); Builder.Xml.Save(super, $"{GlobalVar.ResultPath}/Super.xml"); JbAssert.PathEqual(((super as ConfTree).XmlDoc as XmlDocument).BaseURI, $"file:///{GlobalVar.ResultPath}/Super.xml"); }
public void TestBuild_Xml_Tag() { ConfTree conf = Builder.Xml.Generate($@"{GlobalVar.SamplePath}/Tag.xml"); Debug.WriteLine(conf.ToString()); JbAssert.Equal(conf[@"Default:Func/Item1"], "0"); JbAssert.Equal(conf[@"Tag1:Func/Item1"], "1.1"); JbAssert.Equal(conf[@"Tag2:Func/Item1"], "2.1"); }
public void TestBuild_Xml_SameItemName() { ConfTree conf = Builder.Xml.Generate($@"{GlobalVar.SamplePath}/SameItemName.xml"); Debug.WriteLine(conf.ToString()); JbAssert.Equal(conf[@"Function1/Item1"], "Value1"); JbAssert.Equal(conf[@"Function2/Item1"], "Func2-1"); JbAssert.Equal(conf[@"Function3/Item1"], "Func3-1"); }
public void TestBuild_Xml_Attribute() { ConfTree conf = Builder.Xml.Generate($@"{GlobalVar.SamplePath}/Attribute.xml"); Debug.WriteLine(conf.ToString()); JbAssert.Equal(conf[@"CW/Ith.Min"], "0"); JbAssert.Equal(conf[@"CW/Ith.Max"], "10000"); }
public void TestBuild_Xml_MultiTagWithDefault() { ConfTree conf = Builder.Xml.Generate($@"{GlobalVar.SamplePath}/MultiTagWithDefault.xml"); Debug.WriteLine(conf.ToString()); JbAssert.Equal(conf[@"T1.1:Item1"], "1.1.1.1"); JbAssert.Equal(conf[@"T1.2:Item1"], "1.2.2.1"); JbAssert.Equal(conf[@"T1.2.1:Item1"], "1.2.1.3"); }
public void TestBuild_Xml_Attribute_Modify() { ConfTree conf = Builder.Xml.Generate($@"{GlobalVar.SamplePath}/Attribute.xml"); JbAssert.Equal(conf[@"CW/Ith.Min"], "0"); Debug.WriteLine(conf.ToString()); conf[@"Specs/Spec/CW/Ith.Min"] = "1"; Builder.Xml.Save(conf, $@"{GlobalVar.ResultPath}/Attribute.xml"); conf = Builder.Xml.Generate($@"{GlobalVar.ResultPath}/Attribute.xml"); JbAssert.Equal(conf[@"CW/Ith.Min"], "1"); }
public void TestBuild_Xml_Tag_Derive() { ConfTree conf = Builder.Xml.Generate($@"{GlobalVar.SamplePath}/TagDerive.xml"); Debug.WriteLine(conf.ToString()); }