Beispiel #1
0
        public void not_reproduced_error_tests_old()
        {
            string test = "[ExampleSection]\nkey = value;value\n";

            StringIniParser strParser = new StringIniParser();

            IniData data = strParser.ParseString(test);

            Assert.That(data.Sections.Count, Is.EqualTo(1));
            Assert.That(data.Sections["ExampleSection"], Is.Not.Null);
            Assert.That(data.Sections["ExampleSection"].Count, Is.EqualTo(1));
            Assert.That(data.Sections["ExampleSection"]["key"], Is.EqualTo("value"));
        }
Beispiel #2
0
        public void check_using_another_leading_character_for_comments()
        {
            string data =
            @"[test]
            # a comment
            connectionString = Server=sqlserver.domain.com;Database=main;User ID=user;Password=password";

            StringIniParser parser = new StringIniParser();
            parser.Parser.Configuration.CommentChar = '#';
            IniData iniData = parser.ParseString(data);

            Assert.That(
                iniData["test"]["connectionString"],
                Is.EqualTo("Server=sqlserver.domain.com;Database=main;User ID=user;Password=password"));

            Assert.That(
                iniData["test"].GetKeyData("connectionString").Comments[0], Is.EqualTo(" a comment"));
        }
Beispiel #3
0
        public void Issue9_Tests()
        {
            string data = @"[test]
            connectionString = Server=sqlserver.domain.com;Database=main;User ID=user;Password=password";

            StringIniParser parser = new StringIniParser();
            parser.CommentDelimiter = '#';
            IniData iniData = parser.ParseString(data);

            Assert.That(
                iniData["test"]["connectionString"],
                Is.EqualTo("Server=sqlserver.domain.com;Database=main;User ID=user;Password=password"));
        }