Пример #1
0
        public void TestRead()
        {
            IIniDocument document = IniDocument.Read(@"foo = bar
bork = baz
[test]
sample = someValue
[another test]
value = another value");

            Assert.AreEqual(2, document.Sections.Count, "Correct count of sections");
            Assert.AreEqual(2, document.Count, "Correct count of values");
            Assert.AreEqual("baz", document["bork"], "Correct value for 'bork'");
            Assert.AreEqual("someValue", document.Sections["test"]["sample"], "Correct value for 'test' » 'sample'");
        }
Пример #2
0
        public void TestReadInvalidFile()
        {
            IniDocument.Read(@"foo = bar

; This is a comment
# This is a different comment

this is an invalid line

bork = ""This is a quoted value""
[test]
sample = someValue
[another test]
value = another value");

            Assert.Fail("Test should not reach this point");
        }
Пример #3
0
        public void TestReadCommentedFile()
        {
            IIniDocument document = IniDocument.Read(@"foo = bar

; This is a comment
# This is a different comment

bork = ""This is a quoted value""
[test]
sample = someValue
[another test]
value = another value");

            Assert.AreEqual(2, document.Sections.Count, "Correct count of sections");
            Assert.AreEqual(2, document.Count, "Correct count of values");
            Assert.AreEqual("\"This is a quoted value\"", document["bork"], "Correct value for 'bork'");
            Assert.AreEqual("someValue", document.Sections["test"]["sample"], "Correct value for 'test' » 'sample'");
        }