/// <summary> /// Get list of customer address from .csv files /// </summary> /// <returns>List of customer addresse</returns> public List <CustomerAddress> GetCustomerAddresses() { var customerAddresses = new List <CustomerAddress>(); var rootDirectory = ConfigurationManager.AppSettings.Get("AssessmentBaseDirectory"); var files = _csvFileManager.SearchCSVFile(rootDirectory); foreach (var filePath in files) { if (_csvFileManager.CheckFileSize(filePath)) { var filecontents = _csvFileManager.ReadCSVFile(filePath); customerAddresses.AddRange(ExtractCustomerAddressFromCsvFile(filecontents)); } } return(customerAddresses); }
public void ReadCSVFileTestMethod() { var baseDirectory = ConfigurationManager.AppSettings.Get("AssessmentBaseDirectory"); if (string.IsNullOrEmpty(baseDirectory)) { Assert.Fail(); } var searchFiles = _iCSVFileManager.SearchCSVFile(baseDirectory); if (searchFiles == null) { Assert.IsNull(searchFiles, "No directory contains no files"); } var results = _iCSVFileManager.ReadCSVFile(searchFiles.FirstOrDefault()); Assert.IsTrue(results == null || results?.Count > -1, "Method _iCSVFileManager.ReadCSVFile(searchFiles.FirstOrDefault()) failed"); }