public void ImportCsvFiles() { string pathDataFile = Path.Combine(Environment.CurrentDirectory, "Sample", "Data.csv"); string pathOutputFolder = Path.Combine(Environment.CurrentDirectory, "Sample", "Output"); ICustomImporter customImport = new CustomImport( pathDataFile, pathOutputFolder); customImport.ImportData(); customImport.ProcessOutput(); //Read output file string pathFile1 = Path.Combine(pathOutputFolder, "FirstName And LastName Frequency.txt"); string pathFile2 = Path.Combine(pathOutputFolder, "Address List.txt"); CollectionAssert.AreEqual(File.ReadAllLines(pathFile1), _expectedResultFile1); CollectionAssert.AreEqual(File.ReadAllLines(pathFile2), _expectedResultFile2); }
private static int Run(string csvFile, string outputPath) { try { ICustomImporter customImport = new CustomImport(csvFile, outputPath); if (!Directory.Exists(outputPath)) { Console.WriteLine($"Output Path '{outputPath}' not found"); return(7); } customImport.ImportData(); customImport.ProcessOutput(); return(0); //success for command line app } catch (FileNotFoundException) { Console.WriteLine($"CSV File '{csvFile}' not found"); return(2); } }