public void FileIoTest() { var csv = new CsvImporter(); csv.ImportFile("UnitTestCsvFileIo.csv"); var list = csv.GetData <CTestPerson>().ToList(); Assert.AreEqual(2, list.Count, "Number of data elements is incorrect"); list[0].TestPerson("Homer", "Simpson", 41, 0); list[1].TestPerson("Bart", "Simpson", 6, 0); }
public void PreProcessLineTest() { var linesRead = 0; var csv = new CsvImporter(); csv.OnLineRead += _sb => { linesRead++; for (var i = 0; i < _sb.Length; i++) { _sb[i] = char.ToUpper(_sb[i]); } }; csv.ImportFile("UnitTestCsvFileIo.csv"); var list = csv.GetData <CTestPerson>().ToList(); Assert.AreEqual(2, list.Count, "Number of data elements is incorrect"); list[0].TestPerson("HOMER", "SIMPSON", 41, 0); list[1].TestPerson("BART", "SIMPSON", 6, 0); Assert.AreEqual(7, linesRead, "Number of lines preprocessed, including blank lines"); }