public void CanParseCsvNoHeader(string filePath, string delimeter, string nonAlphaNumericTextExpected) { string text = ContentLoader.GetTextFileContent(filePath); CsvDoc csv = Csv.LoadText(text, false, false, delimeter); // Check the csv data. CsvCheck.AssertColumnDataInt(csv, "0", 0, 1, 1); CsvCheck.AssertColumnData(csv, "1", 0, nonAlphaNumericTextExpected); CsvCheck.AssertColumnData(csv, "2", 0, @"C:\pictures\100_01.JPG"); CsvCheck.AssertColumnDataDate(csv, "3", 0, DateTime.Parse("4/10/2009"), 1); }
public void CanParseCsv_WithNewLines() { string expected = "Testing" + Environment.NewLine + "new line"; string text = ContentLoader.GetTextFileContent("Csv.Csv_MultiLine.csv"); CsvDoc csv = Csv.LoadText(text, true); // Check the csv data. CsvCheck.AssertColumnDataInt(csv, "Id", 0, 1, 1); CsvCheck.AssertColumnData(csv, "NonAlphaNumeric", 0, @"(`~!@#$%^&*()_+-=[]\{}|<>?./;:)"); CsvCheck.AssertColumnData(csv, "Description", 0, expected); CsvCheck.AssertColumnDataDate(csv, "Date", 0, DateTime.Parse("4/10/2009"), 1); }
public void CanParseCsv(string filePath, char delimeter, string nonAlphaNumericTextExpected, bool expectEscapedQuote) { string text = ContentLoader.GetTextFileContent(filePath); text = CultureInfoHelper.FixDates(text); CsvDoc csv = Csv.LoadText(text, true, false, delimeter); // Check the csv data. CsvCheck.AssertColumnDataInt(csv, "Id", 0, 1, 1); CsvCheck.AssertColumnData(csv, "NonAlphaNumeric", 0, nonAlphaNumericTextExpected); if (!expectEscapedQuote) { CsvCheck.AssertColumnData(csv, "FilePath", 0, @"C:\pictures\100_01.JPG"); } else { CsvCheck.AssertColumnData(csv, "FilePath", 0, @"C"":\pictures\100_01.JPG"); } CsvCheck.AssertColumnDataDate(csv, "Date", 0, DateTime.Parse(CultureInfoHelper.FixDates("4/10/2009")), 1); }