public void PrintGameBoard() { GameBoardManager gameBoardManager = new GameBoardManager(); gameBoardManager.GenerateNewGameBoard(); StringBuilder gameBoardAsString = new StringBuilder(); StringBuilder printed = new StringBuilder(); StringBuilder current = new StringBuilder(); gameBoardAsString.AppendLine(); for (int col = 0; col < 8; col++) { for (int row = 0; row < 25; row++) { gameBoardAsString.Append(gameBoardManager.GameBoard[row, col]); } gameBoardAsString.AppendLine(); } Console.SetOut(new System.IO.StringWriter(printed)); gameBoardManager.PrintGameBoard(); Console.SetOut(new System.IO.StringWriter(current)); Console.WriteLine(gameBoardAsString); Assert.AreEqual(current.ToString(), printed.ToString()); }
public void RemainingBaloons_OneShot() { GameBoardManager gameBoardManager = new GameBoardManager(); gameBoardManager.GenerateNewGameBoard(); string input = "0 0"; Coordinates coordinates = new Coordinates(); Coordinates.TryParse(input, ref coordinates); gameBoardManager.ShootBaloons(coordinates); Assert.IsTrue(gameBoardManager.RemainingBaloons < 50); }
/// <summary> /// Main method make initialization of main classes, call engine to start the game and print welcome message. /// </summary> internal static void Main() { PrintWelcomeMessage(); GameBoardManager gameBoardManager = new GameBoardManager(); gameBoardManager.GenerateNewGameBoard(); gameBoardManager.PrintGameBoard(); Engine egine = new Engine(); egine.Run(gameBoardManager); }
public void ShootBaloons_CoordinatesTwoOne() { GameBoardManager gameBoardManager = new GameBoardManager(); gameBoardManager.GenerateNewGameBoard(); string input = "2 1"; Coordinates coordinates = new Coordinates(); Coordinates.TryParse(input, ref coordinates); gameBoardManager.ShootBaloons(coordinates); char arr = gameBoardManager.GameBoard[6, 2]; char result = '.'; Assert.AreEqual(result, arr); }
public void ShootCounter_ThreeShoots() { GameBoardManager gameBoardManager = new GameBoardManager(); gameBoardManager.GenerateNewGameBoard(); string input = "0 0"; Coordinates coordinates = new Coordinates(); Coordinates.TryParse(input, ref coordinates); gameBoardManager.ShootBaloons(coordinates); input = "1 1"; Coordinates.TryParse(input, ref coordinates); gameBoardManager.ShootBaloons(coordinates); input = "2 2"; Coordinates.TryParse(input, ref coordinates); gameBoardManager.ShootBaloons(coordinates); Assert.AreEqual(3, gameBoardManager.ShootCounter); }
public void ShootBaloons_HitPosition() { GameBoardManager gameBoardManager = new GameBoardManager(); gameBoardManager.GenerateNewGameBoard(); string input = "2 1"; Coordinates coordinates = new Coordinates(); Coordinates.TryParse(input, ref coordinates); gameBoardManager.ShootBaloons(coordinates); input = "0 1"; Coordinates.TryParse(input, ref coordinates); gameBoardManager.ShootBaloons(coordinates); }