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)); }
public static void BasicTest(string data) { RowConfigReader rcr = new RowConfigReader(data); Assert.Equal("stringVal", rcr.GetNextValue("stringKey")); Assert.Equal(12, rcr.GetNextValueAsInt32("intKey")); }
public static void KeyContainedInValue() { string data = $"first keyFirstValue{Environment.NewLine}key value"; RowConfigReader rcr = new RowConfigReader(data); Assert.Equal("value", rcr.GetNextValue("key")); }
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")); }
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")); }
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")); }
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")); }
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)); }
public static void KeyContainedInValue() { string data = $"first keyFirstValue{Environment.NewLine}key value"; RowConfigReader rcr = new RowConfigReader(data); Assert.Equal("value", rcr.GetNextValue("key")); }
public static void BasicTest(string data) { RowConfigReader rcr = new RowConfigReader(data); Assert.Equal("stringVal", rcr.GetNextValue("stringKey")); Assert.Equal(12, rcr.GetNextValueAsInt32("intKey")); }