public async Task Expected_number_of_rows_can_be_found_after_parsing_csv() { var csvTreeReader = new CsvTreeReader(RyansTreeCsv, null); var people = await csvTreeReader.ReadAllAsync(); Assert.Equal(282, people.Count); }
public async Task Csv_can_be_read_and_rows_parsed() { var csvTreeReader = new CsvTreeReader(RyansTreeCsv, null); var people = await csvTreeReader.ReadAllAsync(); Assert.NotEmpty(people); }
public async Task Corrupt_file_contents_do_not_cause_error() { var csvTreeReader = new CsvTreeReader(CorruptTreeCsv, null); var people = await csvTreeReader.ReadAllAsync(); Assert.Empty(people); }
public async Task Missing_file_does_not_cause_error() { var csvTreeReader = new CsvTreeReader("abcd", null); var people = await csvTreeReader.ReadAllAsync(); Assert.Empty(people); }
public static async Task <List <WhoWhatWhereWhen> > ParseTreesFromFilePathAsync(string filePath) { var csvLoader = new CsvTreeReader(filePath, null); var imported = await csvLoader.ReadAllAsync(); var treeParser = ConfigureDi.Services.GetRequiredService <TreeParser>(); return(treeParser.ParseListIntoTrees(imported)); }
public async Task Trees_can_be_written() { var csvTreeReader = new CsvTreeReader(RyansTreeCsv, null); var people = await csvTreeReader.ReadAllAsync(); var treeParser = serviceProvider.GetRequiredService <TreeParser>(); var trees = treeParser.ParseListIntoTrees(people); var file = new System.IO.FileInfo(Guid.NewGuid().ToString() + ".json"); var jsonTreeWriter = new JsonTreeWriter(null, file.FullName); await jsonTreeWriter.WriteAllAsync(trees); Assert.True(file.Exists); }