public void WriteTest() { string expectedFilePath = Path.GetDirectoryName(testPath) + @"\sorted-names-list.txt"; _sorter.parseFile(testPath); _sorter.sort(); _sorter.writeToFile(); Assert.True(File.Exists(expectedFilePath), "File not found at: " + expectedFilePath); }
static void Main(string[] args) { var app = new NameSorter(); Console.WriteLine("nameSorter initialised.\n\n"); string input = null; if (args.Length == 0 || !File.Exists(args[0])) { while (input == null) { Console.WriteLine("Please enter correct file path:\n"); input = Console.ReadLine(); if (input != null && (File.Exists(Path.GetFullPath(input)))) { break; } input = null; } } else { input = args[0]; } app.parseFile(input); Console.Write("Reading file...\n"); app.sort(); Console.Write("Sorting...\n"); app.writeToFile(); Console.Write("Writing to file...\n\n"); app.displaySorted(); Console.Write("\n\nSort Complete. Press Any Key to exit..."); Console.ReadKey(true); }