public void TestWriteCsv() { string output; string expectedOutput = "foo,bar,baz\r\n" + "wibble,wobble,spong"; IList <IList <string> > input = new string[][] { new string[] { "foo", "bar", "baz" }, new string[] { "wibble", "wobble", "spong" } }; ITabularDataParser parser = new TabularDataParser(TabularDataFormat.CreateCsv()); output = parser.Write(input); Assert.AreEqual(expectedOutput, output, "Correct string rendering"); }
public void TestWriteTsvWithQuotes() { string output; string expectedOutput = "foo\tbar\tbaz\n" + "wibble\t wobble \tspong\n" + " foo\t\"bar\"\tbaz,bork"; IList <IList <string> > input = new string[][] { new string[] { "foo", "bar", "baz" }, new string[] { "wibble", " wobble ", "spong" }, new string[] { " foo", "\"bar\"", "baz,bork" } }; ITabularDataParser parser = new TabularDataParser(TabularDataFormat.CreateTsv()); output = parser.Write(input); Assert.AreEqual(expectedOutput, output, "Correct string rendering"); }
public void TestWriteTsvFrom2DArray() { string output; string expectedOutput = "foo\tbar\tbaz\n" + "wibble\twobble\tspong"; string[,] input = new string[, ] { { "foo", "bar", "baz" }, { "wibble", "wobble", "spong" } }; ITabularDataParser parser = new TabularDataParser(TabularDataFormat.CreateTsv()); output = parser.Write(input); Assert.AreEqual(expectedOutput, output, "Correct string rendering"); }