public void ShouldBuildCaseInsensitiveDictionary()
        {
            string value = "Name=\"Foo\"";
            IDictionary <string, string> props = KeyValueParser.Parse(value);

            Assert.IsTrue(props.ContainsKey("name"));
        }
        public void ShouldSupportMixingQuoteTypes()
        {
            string value = "Name='Foo' Value=\"Bar\"";
            IDictionary <string, string> props = KeyValueParser.Parse(value);

            Assert.AreEqual(2, props.Count);
        }
        public void ShouldParseAttributes()
        {
            string value = "Name=\"Foo\" Value=\"Hey\"";
            IDictionary <string, string> props = KeyValueParser.Parse(value);

            Assert.AreEqual(2, props.Count);
        }
        public void ThrowsIfDuplicateAttribute()
        {
            string value = "Name=\"Foo\" Name=\"Hey\"";
            IDictionary <string, string> props = KeyValueParser.Parse(value);

            Assert.AreEqual(2, props.Count);
        }
Beispiel #5
0
        public void Parse_Uses_MissingValue()
        {
            var parser = new KeyValueParser('=', "ug");

            string key, value;

            parser.Parse("a", out key, out value);

            Assert.AreEqual("a", key);
            Assert.AreEqual("ug", value);
        }
Beispiel #6
0
        public void Parse_Uses_Separator()
        {
            var parser = new KeyValueParser(':', "");

            string key, value;

            parser.Parse("Z1: a=b", out key, out value);

            Assert.AreEqual("Z1", key);
            Assert.AreEqual(" a=b", value);
        }
Beispiel #7
0
        public void Parse_Splits_Key_And_Value_Correctly(string text, string expectedKey, string expectedValue)
        {
            var parser = new KeyValueParser();

            string key, value;

            parser.Parse(text, out key, out value);

            Assert.AreEqual(expectedKey, key);
            Assert.AreEqual(expectedValue, value);
        }
 public void ThrowsIfNullValue()
 {
     KeyValueParser.Parse(null);
 }
 private ISettingsNode Parse()
 => parser.Parse(fileName, content);