public void ParseLine_InvalidDateTimeFormat_Exception() { CsvLineParser lineParser = new CsvLineParser(TestInitializationFactory.GenerateFakeColumnTypes()); string lineToParse = "2018ax01-03 12:00:00, 1,2,3,4,5"; Assert.Catch(() => lineParser.ParseLine(lineToParse)); }
public void LoadAll_SimpleFileLoad_Success() { CsvImporter importer = new CsvImporter(relativePath, TestInitializationFactory.GenerateFakeColumnTypes()); var result = importer.LoadAll(); int numItems = EnumerateTestAndCount(result); // Test that All items have been read Assert.AreEqual(numItems, 7); }
public void LoadNext_LoadLast3Lines_Success() { CsvImporter importer = new CsvImporter(relativePath, TestInitializationFactory.GenerateFakeColumnTypes()); bool endOfFile; var result = importer.LoadRange(3, out endOfFile, 4); int numItems = EnumerateTestAndCount(result); // Test that All items have been read Assert.AreEqual(numItems, 3); Assert.AreEqual(endOfFile, true); }
public void ParseLine_ValidLineParse_Success() { CsvLineParser lineParser = new CsvLineParser(TestInitializationFactory.GenerateFakeColumnTypes()); string lineToParse = "2018-01-03 12:00:00, 1,2,3,4,5"; DataObject result = lineParser.ParseLine(lineToParse); Assert.AreEqual(result.Columns.Length, 6); Assert.AreEqual(result.Columns[0].GetType(), typeof(DateTime)); for (int i = 1; i < 6; i++) { Assert.AreEqual(result.Columns[i].GetType(), typeof(int)); Assert.AreEqual(result.Columns[i], i); } }