public void DefaultParserInterpretsTrailingFieldDelimiterAsExtraEmptyField() { char delimiter = ','; string[] actual, expected = DaysOfTheWeek.ToArray(); actual = new string[expected.Length + 1]; var record = string.Join(delimiter, expected) + delimiter; record.EndsWith(delimiter).ShouldBeTrue(); var parser = Parser.Create(delimiter: delimiter); parser.Parse(record, actual).ShouldBe(expected.Length + 1); }
public void DefaultParserCanParseFieldsWithNoQuotedStrings() { var delimiter = '|'; var expected = DaysOfTheWeek.ToArray(); var record = string.Join(delimiter, expected); var parser = Parser.Create(delimiter: delimiter); var actual = new string[expected.Length]; parser.Parse(record, actual).ShouldBe(expected.Length); for (var i = 0; i < expected.Length; i++) { actual[i].ShouldBe(expected[i]); } }