[ExcludeFromCodeCoverage] //Cannot Test for User Input public void StartGame() { try { Board gameBoard = _boardFactory.CreateBoard(); Logger.Info("New Game Board created"); Player player = _playerFactory.CreatePlayer(); _userInterface.RenderMessage("Shuffle! New Game Started."); player.SetPlayerName(_userInterface.AskForPlayerName()); player.SetLives(); Logger.Info("New Player Created"); _userInterface.ClearScreen(); _userInterface.RenderMessage($"Welcome {player.Name} to Shuffle!"); _userInterface.RenderMessage( "Move your piece to the top of the board to win. Watch out for mines, hit two and its GAME OVER!"); _userInterface.NewLine(); bool success = gameBoard.DrawBoard(); if (!success) { throw new ApplicationException("Something went wrong while drawing the board"); } _userInterface.NewLine(); _userInterface.RenderMessage("Ready Player One."); Logger.Info("Turns Started"); TakeTurns(gameBoard, player); string askToPlayAgainResult = _userInterface.AskToPlayAgain(); bool isNewGameWanted = _userInterface.ValidatePlayAgainResponse(askToPlayAgainResult); if (isNewGameWanted) { _userInterface.ClearScreen(); StartGame(); } else { _userInterface.ClearScreen(); _userInterface.RenderMessage($"Thanks for playing {player.Name}. Press any key to exit and press enter"); } _userInterface.GetUserInput(); } catch (Exception exception) { Logger.Error(exception, "An Error Occured: {0}", exception.Message); _userInterface.RenderMessage($"An Error Occured: {exception}"); _userInterface.RenderMessage("Press Any Key to Exit"); _userInterface.GetUserInput(); } }