public void TestReadCsv() { string input = "foo,bar,baz\r\n" + "wibble,wobble,spong"; ITabularDataParser parser = new TabularDataParser(TabularDataFormat.CreateCsv()); var output = parser.Read(input); Assert.AreEqual(2, output.GetRowCount(), "Correct row count"); Assert.AreEqual("wibble", output[1][0], "Correct data in second row, first column"); Assert.AreEqual("wobble", output[1][1], "Correct data in second row, second column"); }
public void TestReadCsvWithQuotedUnicode() { string input = "foo,bar,baz\r\n" + "wibble, wobble ,spong\r\n" + "\" foo\",\"\"\"bar\"\"\",\"A big, \"\"big, ¥en test!\""; ITabularDataParser parser = new TabularDataParser(TabularDataFormat.CreateCsv()); var output = parser.Read(input); Assert.AreEqual(3, output.GetRowCount(), "Correct row count"); Assert.AreEqual("wobble", output[1][1], "Correct data in second row, second column"); Assert.AreEqual(" foo", output[2][0], "Correct data in third row, first column"); Assert.AreEqual("\"bar\"", output[2][1], "Correct data in third row, second column"); Assert.AreEqual("A big, \"big, ¥en test!", output[2][2], "Correct data in third row, third column"); }