Пример #1
0
        public void Ini_Write_NormalContent()
        {
            parser = new IniParser();
            parser.AddDicConf(dicoTest1);
            parser.AddDicConf(dicoTest2);
            bool success = parser.WriteContent(file_1_out, AppDomain.CurrentDomain.BaseDirectory);

            Assert.IsTrue(success, "The write should have been successful");
        }
Пример #2
0
        public void Ini_Add_AddBadDico()
        {
            // try t fetch from a header that doesn't have the variable
            parser = new IniParser();
            Assert.IsTrue(parser.isEmpty, "isEmpty flag should be true");

            bool add = parser.AddDicConf(new DicConfiguration());

            Assert.IsFalse(add, "Should return false for this add");
            Assert.IsTrue(parser.isEmpty, "isEmpty flag should still be true");
        }
Пример #3
0
        public void Ini_Add_AddSameDico()
        {
            // try t fetch from a header that doesn't have the variable
            parser = new IniParser();
            Assert.IsTrue(parser.isEmpty, "isEmpty flag should be true");

            bool add = parser.AddDicConf(dicoTest1);

            Assert.IsTrue(add, "Adding the dicConfig should return true");
            Assert.IsFalse(parser.isEmpty, "isEmpty flag should be false");

            // try to readd the same DicConfig
            bool add2 = parser.AddDicConf(dicoTest1);

            Assert.IsFalse(add2, "Adding the second dicConfig should return false");

            // fetch should still work
            string result1 = parser.GetValue("head", "var");

            Assert.AreEqual(result1, "val", "Value is not as expected");
        }