public void Validate_PerfectFile_Pass() { var csvTransaction = new CsvTransactionModel { TransactionId = "Inv00001", TransactionDate = "20/02/2019 12:33:16", Amount = "200.00", CurrencyCode = "USD", Status = "Finished" }; List <string> result = csvValidator.Validate(csvTransaction); Assert.IsTrue(result.Count == 0); }
private void CallCsvReader(IFormFile file, ref List <string> errorMesages) { List <CsvTransactionModel> csvTransactionModels = csvTransactionReader.Read(file); if (csvTransactionModels.Count > 0) { foreach (CsvTransactionModel transaction in csvTransactionModels) { errorMesages.AddRange(csvValidator.Validate(transaction)); } if (errorMesages.Count == 0) { IEnumerable <TransactionModel> transactionModels = csvTransactionModels.Select(s => s.MapToModel()); transactionRepository.AddRange(transactionModels); } } }