Пример #1
0
        public void CheckReadRowsLowLevelWithMappingCount(int expected)
        {
            var mapper = new RowModelMapper();
            var count  = CsvHelperProxy
                         .ReadRowsLowLevel(Path.Combine("Assets", "bigfile.csv"))
                         .Select(mapper.Map)
                         .Skip(1)
                         .Where(m => m != null)
                         .Count();

            Assert.Equal(expected, count);
        }
Пример #2
0
        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);
        }
Пример #3
0
        public void CheckReadRowsLowLevelCount(int expected)
        {
            var count = CsvHelperProxy.ReadRowsLowLevel(Path.Combine("Assets", "bigfile.csv")).Count();

            Assert.Equal(expected, count);
        }