// Public Methods public bool Load() { // Instantiate a new Source Address file manager to load the applicable filenames and paths from disk _objSourceAddressFileManager = new BLL.SourceAddressFileManager(); try { // Get the pathing info from the config file FileAndDirectoryLocationCalculator objFileAndDirLocationCalc = new FileAndDirectoryLocationCalculator(); // Load the filenames from disk if (_objSourceAddressFileManager.LoadFilesNamesFromDisk(objFileAndDirLocationCalc.GetProcessingRoot())) { // The file names have been loaded from disk } else { throw new Exception(String.Format("Could not load the files from disk. Error Messages = [{0}]", String.Join(" | ", _objSourceAddressFileManager.ErrorMessages.ToArray()))); } } catch (Exception ex) { string strErrorMessage = String.Format("There was an error while trying to load the Excel files from disk. Error Messages = [{0}]", ex.Message); _objLogger.Warn(String.Format("An error condition was detected, and should eventually be thrown as an exception. Error Message = [{0}]", strErrorMessage)); _lstErrorMessages.Add(strErrorMessage); } return(_lstErrorMessages.Count == 0); }
public void Test_LoadFilesFromDisk() { BLL.FileAndDirectoryLocationCalculator objFileAndDirLocationCalc = new BLL.FileAndDirectoryLocationCalculator(); BLL.SourceAddressFileManager objSourceAddressFileManager = new BLL.SourceAddressFileManager(); Assert.IsTrue(objSourceAddressFileManager.LoadFilesNamesFromDisk(objFileAndDirLocationCalc.GetProcessingRoot())); Assert.IsTrue(objSourceAddressFileManager.XLSXFilesToProcess.Count == 3); Assert.IsTrue(objSourceAddressFileManager.ErrorMessages.Count == 0); }