Exemplo n.º 1
0
        public ParallelQuery <CsvMappingResult <Cost> > ParseCost()
        {
            CSVCostMapper    csvMapper = new CSVCostMapper(CSVFileHeaders);
            CsvParser <Cost> csvParser = new CsvParser <Cost>(this.csvParseOptions, csvMapper);

            return(csvParser
                   .ReadFromFile(CSVInputFile, Encoding.UTF8));
        }
Exemplo n.º 2
0
        public void csvParser_CostParserOnMERGED_ReturnListOfCostInstances()
        {
            var headers = File.ReadLines(testLargeCSVFile).First().Split(',').ToList();
            CsvParserOptions csvParserOptions = new CsvParserOptions(true, ',');
            CSVCostMapper    csvMapper        = new CSVCostMapper(headers);
            CsvParser <Cost> csvParser        = new CsvParser <Cost>(csvParserOptions, csvMapper);

            var result = csvParser
                         .ReadFromFile(testLargeCSVFile, Encoding.UTF8)
                         .ToList();

            Assert.AreEqual(7175, result.Count);
            var errors = result.Where(e => !e.IsValid);

            Assert.IsTrue(result.All(x => x.IsValid));
        }