public void CheckResultsBetweenTwoMethods() { var filepath = Path.Combine("Assets", "bigfile.csv"); var mapper = new RowModelMapper(); var homeMade = CsvHelperProxy .ReadRows(filepath) .Select(mapper.Map) .Skip(1) .Where(m => m != null).ToList(); var expected = CsvHelperProxy.Read <RowModel, RowModelMap>(filepath).ToList(); foreach (var r in expected) { Assert.True(homeMade.Remove(r), r.ToString() + " NotFound"); } Assert.Empty(homeMade); homeMade = CsvHelperProxy .ReadRowsLowLevel(filepath) .Select(mapper.Map) .Skip(1) .Where(m => m != null).ToList(); foreach (var r in expected) { Assert.True(homeMade.Remove(r), r.ToString() + " NotFound"); } Assert.Empty(homeMade); var automapper = new MapperConfiguration(cfg => _ = MapperHelper.Configure(cfg)).CreateMapper(); homeMade = CsvHelperProxy .ReadRows(filepath) .Select(v => automapper.Map <RowModel>(v)) .Skip(1) .Where(m => m != null).ToList(); foreach (var r in expected) { Assert.True(homeMade.Remove(r), r.ToString() + " NotFound"); } Assert.Empty(homeMade); }
public void CheckReadWithMappingCount(int expected) { var count = CsvHelperProxy.Read <RowModel, RowModelMap>(Path.Combine("Assets", "bigfile.csv")).Count(); Assert.Equal(expected, count); }