[ExcludeFromCodeCoverage] //Cannot Test for User Input private void TakeTurns(Board gameBoard, Player player) { while (true) { string requestedMove = _userInterface.AskForMove(); int move = _userInterface.ValidateMove(requestedMove); switch (move) { case (int)Direction.Up: _userInterface.ClearScreen(); gameBoard.MovePlayer(Direction.Up); break; case (int)Direction.Down: _userInterface.ClearScreen(); gameBoard.MovePlayer(Direction.Down); break; case (int)Direction.Left: _userInterface.ClearScreen(); gameBoard.MovePlayer(Direction.Left); break; case (int)Direction.Right: _userInterface.ClearScreen(); gameBoard.MovePlayer(Direction.Right); break; case (int)Direction.Invalid: _userInterface.RenderMessage( $"{requestedMove} is not a valid move ('U','D','L', or 'R'). Please try again."); continue; default: _userInterface.RenderMessage( $"{requestedMove} is not a valid move ('U','D','L', or 'R'). Please try again."); continue; } int cellStatus = gameBoard.GetCellStatus(gameBoard.PlayerPosition); if (cellStatus == (int)CellStatus.PlayerIsHit) { player.LoseLife(); } Logger.Info("Player took a turn"); gameBoard.DrawBoard(); if (!player.IsPlayerAlive()) { Logger.Info($"Player: {player.Name} Died. Ending Turns."); _userInterface.RenderMessage($"{player.Name} you have no lives left! Game Over Man, Game Over."); _userInterface.NewLine(); break; } bool hasPlayerWon = gameBoard.IsCellInTopRow(gameBoard.PlayerPosition); if (hasPlayerWon) { Logger.Info($"Player: {player.Name} Won the game. Ending Turns."); _userInterface.RenderMessage($"{player.Name} you Won! Congratualtions!"); _userInterface.NewLine(); break; } } }