Пример #1
0
        public static void NewlineTests(string data)
        {
            // Test strings which have newlines mixed in between data pairs.

            RowConfigReader rcr = new RowConfigReader(data);

            Assert.Equal("00", rcr.GetNextValue("value0"));
            Assert.Equal(0, rcr.GetNextValueAsInt32("value0"));
            Assert.Equal(1, rcr.GetNextValueAsInt32("value1"));
            Assert.Equal("2", rcr.GetNextValue("value2"));
            Assert.Equal("3", rcr.GetNextValue("value3"));

            string unused;

            Assert.False(rcr.TryGetNextValue("Any", out unused));
        }
Пример #2
0
        public static void BasicTest(string data)
        {
            RowConfigReader rcr = new RowConfigReader(data);

            Assert.Equal("stringVal", rcr.GetNextValue("stringKey"));
            Assert.Equal(12, rcr.GetNextValueAsInt32("intKey"));
        }
Пример #3
0
        public static void KeyContainedInValue()
        {
            string          data = $"first keyFirstValue{Environment.NewLine}key value";
            RowConfigReader rcr  = new RowConfigReader(data);

            Assert.Equal("value", rcr.GetNextValue("key"));
        }
Пример #4
0
 public static void BasicTestCaseInsensitive(string data)
 {
     // Use a case-insensitive comparer and use differently-cased keys.
     RowConfigReader rcr = new RowConfigReader(data, StringComparison.OrdinalIgnoreCase);
     Assert.Equal("stringVal", rcr.GetNextValue("stringkey"));
     Assert.Equal(12, rcr.GetNextValueAsInt32("intkey"));
 }
Пример #5
0
        public static void BasicTestCaseInsensitive(string data)
        {
            // Use a case-insensitive comparer and use differently-cased keys.
            RowConfigReader rcr = new RowConfigReader(data, StringComparison.OrdinalIgnoreCase);

            Assert.Equal("stringVal", rcr.GetNextValue("stringkey"));
            Assert.Equal(12, rcr.GetNextValueAsInt32("intkey"));
        }
Пример #6
0
        public static void KeyDoesNotStartLine()
        {
            string data = $"key value{Environment.NewLine} key2 value2";
            RowConfigReader rcr = new RowConfigReader(data);

            string unused;
            Assert.False(rcr.TryGetNextValue("key2", out unused));

            // Can retrieve value if key includes the preceding space.
            Assert.Equal("value2", rcr.GetNextValue(" key2"));
        }
Пример #7
0
        public static void KeyDoesNotStartLine()
        {
            string          data = $"key value{Environment.NewLine} key2 value2";
            RowConfigReader rcr  = new RowConfigReader(data);

            string unused;

            Assert.False(rcr.TryGetNextValue("key2", out unused));

            // Can retrieve value if key includes the preceding space.
            Assert.Equal("value2", rcr.GetNextValue(" key2"));
        }
Пример #8
0
        public static void NewlineTests(string data)
        {
            // Test strings which have newlines mixed in between data pairs.

            RowConfigReader rcr = new RowConfigReader(data);
            Assert.Equal("00", rcr.GetNextValue("value0"));
            Assert.Equal(0, rcr.GetNextValueAsInt32("value0"));
            Assert.Equal(1, rcr.GetNextValueAsInt32("value1"));
            Assert.Equal("2", rcr.GetNextValue("value2"));
            Assert.Equal("3", rcr.GetNextValue("value3"));

            string unused;
            Assert.False(rcr.TryGetNextValue("Any", out unused));
        }
Пример #9
0
 public static void KeyContainedInValue()
 {
     string data = $"first keyFirstValue{Environment.NewLine}key value";
     RowConfigReader rcr = new RowConfigReader(data);
     Assert.Equal("value", rcr.GetNextValue("key"));
 }
Пример #10
0
 public static void BasicTest(string data)
 {
     RowConfigReader rcr = new RowConfigReader(data);
     Assert.Equal("stringVal", rcr.GetNextValue("stringKey"));
     Assert.Equal(12, rcr.GetNextValueAsInt32("intKey"));
 }