static void Main(string[] args) { CsvParserOptions csvParserOptions = new CsvParserOptions(true, ','); CSVTurnoverStatsMapping csvMapper = new CSVTurnoverStatsMapping(); CsvParser <TurnoverStats> csvParser = new CsvParser <TurnoverStats>(csvParserOptions, csvMapper); var result = csvParser .ReadFromFile(@"Data\\2018-10-01-ailane.csv", Encoding.UTF8) .ToList(); CsvMappingResult <TurnoverStats> csvMappingResult = new CsvMappingResult <TurnoverStats>(); bool b = csvMappingResult.IsValid; }
public void OneTimeSetUp() { var mappingError = new CsvMappingError { ColumnIndex = 44, Value = "Test error" }; _data0 = new InstallationData { ComputerId = 03, UserId = 04, ApplicationId = 05, ComputerType = ComputerType.Laptop }; _data1 = new InstallationData { ComputerId = 13, UserId = 14, ApplicationId = 15, ComputerType = ComputerType.Desktop }; _data2 = new InstallationData { ComputerId = 23, UserId = 24, ApplicationId = 25, ComputerType = ComputerType.Laptop }; var valid0 = new CsvMappingResult <InstallationData> { RowIndex = 0, Result = _data0 }; var valid1 = new CsvMappingResult <InstallationData> { RowIndex = 1, Result = _data1 }; var valid2 = new CsvMappingResult <InstallationData> { RowIndex = 2, Result = _data2 }; // Note Result would likely be null in a real error item, (but possibly not). This wild data allows us to check that IsValid is used during conversion, not (null != Result) which would be wrong. var invalid1 = new CsvMappingResult <InstallationData> { RowIndex = 1, Error = mappingError, Result = _data1 }; _allValid = new List <CsvMappingResult <InstallationData> > { valid0, valid1, valid2 }; _invalidIndex1 = new List <CsvMappingResult <InstallationData> > { valid0, invalid1, valid2 }; }
public ParsedRow(int position, CsvMappingResult <TEntity> result) { Position = position; Result = result; }
public CsvMappingResultWrapper(CsvMappingResult <CsvCurrencyTransactionRow> row) { this.row = row; }