public void ReadFileTest() { var tempFile = Path.GetTempFileName(); var content = string.Empty; File.WriteAllText(tempFile, content); var gir = new GameInputReader(new BusinessLog()); gir.MovesConfigPath = tempFile; gir.TableConfigPath = tempFile + "XYZ"; var mfc = gir.GetMovesConfig(); Assert.IsTrue(mfc.Length == 0); content = "a" + Environment.NewLine + "b"; File.WriteAllText(tempFile, content); mfc = gir.GetMovesConfig(); Assert.IsTrue(mfc.Length == 2); Assert.ThrowsException <BusinessException>(() => gir.GetTableConfig()); }
static void Main(string[] args) { if (args.Length != 2) { Console.WriteLine("Cannot start application with wrong number of arguments."); Console.WriteLine("Example: .\\TurtleChallangeCSharp.exe game-settings moves"); } else { var logger = new BusinessLog(); var gir = new GameInputReader(logger); gir.TableConfigPath = args[0]; gir.MovesConfigPath = args[1]; var gameManager = new GameManager(gir, new MovesConfigParser(logger), new TableConfigParser(logger), new TurtleStateMachine(logger), logger); var results = gameManager.RunGame(); foreach (var result in results) { Console.WriteLine(result.ResultString); } } }