Exemple #1
0
        public void writeTest()
        {
            BMyIni Mock = new BMyIni("[Section1]");

            Assert.IsTrue(Mock.Write("Section1", "foo", "bar"));
            Assert.IsTrue(Mock.Write("Section2", "foo", "bar"));
            Assert.IsFalse(Mock.Write("[Section3]", "foo", "bar"));
        }
Exemple #2
0
        public void getSerializedTest()
        {
            BMyIni Mock = new BMyIni("");

            Mock.Write("Section1", "Key1", "Value1");
            Mock.Write("Section1", "Key2", "Value2");
            Assert.AreEqual("[Section1]\r\nKey1=\"Value1\"\r\nKey2=\"Value2\"", Mock.GetSerialized());

            BMyIni MockB = new BMyIni("");

            MockB.GetSerialized();
            MockB.Write("Section A", "Key 1", "value 1");
            MockB.Write("Section A", "Key 1", "value 2  ");
            MockB.Write("Section A", "Key 2", "valueG");
            MockB.Write("[foo]", "Bar", "baz");
            Assert.AreEqual("[Section A]\r\nKey 1=\"value 2  \"\r\nKey 2=\"valueG\"", MockB.GetSerialized());

            BMyIni MockC = new BMyIni(testIni_3);

            Assert.AreEqual(testIni_3, MockC.GetSerialized());
        }