예제 #1
0
        public void CfgMgr_Xml_Read_Empty()
        {
            string          path   = Path.Combine(localFolder, file_1_empty);
            XmlConfigSystem cfgsys = new XmlConfigSystem();

            configManager = new CfgManager(path, cfgsys);
            configManager.ReadConfig();

            Assert.AreEqual(0, configManager.GetDictionary().Count, "Dictionary should be empty");
        }
예제 #2
0
        public void CfgMgr_Xml_Write()
        {
            string          path   = Path.Combine(localFolder, file_xml_1_out);
            XmlConfigSystem cfgsys = new XmlConfigSystem();

            configManager = new CfgManager(path, cfgsys);
            configManager.SetDictionary(dicoXml);
            configManager.WriteConfig();

            Assert.IsTrue(XmlFileCompare(Path.Combine(localFolder, file_xml_1_out), Path.Combine(localFolder, file_xml_1)), "Files are not the same");
        }
예제 #3
0
        public void CfgMgr_Xml_Read_CfgSysInstance()
        {
            string          path   = Path.Combine(localFolder, file_xml_1);
            XmlConfigSystem cfgsys = new XmlConfigSystem();

            configManager = new CfgManager(path, cfgsys);
            configManager.ReadConfig();

            Assert.AreEqual(5, configManager.GetDictionary().Count, "Dictionary Size should be 5");
            string value1 = configManager.GetValue("long");

            Assert.AreEqual("string with spaces", value1, "Content of \"long\" should be \"string with spaces\"");
            string value2 = configManager.GetValue("test");

            Assert.AreEqual("value", value2, "Content for \"test\" should be \"value\"");
            string value3 = configManager.GetValue("bar");

            Assert.AreEqual("", value3, "Content for \"bar\" should be empty");
        }