public void NotEnoughArgsShowsUsage() { using (var consoleOutput = new ConsoleOutput()) { var args = new string[] { "foo" }; Program.Main(args); var expectedConsoleOut = "Usage: Robots.exe <configFilePath> <outputFilePath>" + NewLine; Assert.AreEqual(expectedConsoleOut, consoleOutput.GetOuput()); } }
public void ConfigFileNotFoundShowsHelpfulMessage() { using (var consoleOutput = new ConsoleOutput()) { var args = new string[] { "foo", "bar" }; Program.Main(args); // Message will show absolute file path so need to ignore the machine-specific bit var prefix = "Could not find file \"/"; var suffix = "/Robots/RobotsTest/bin/Debug/foo\"." + NewLine; StringAssert.StartsWith(prefix, consoleOutput.GetOuput()); StringAssert.EndsWith(suffix, consoleOutput.GetOuput()); } }