public void AskForPlayersMove(Player pl, Board gameBoard) { int gameBoardSize = gameBoard.GetBoardSize(); ConsoleKeyInfo input ; do { Console.WriteLine(pl.GetPlayerName() + " it is your turn. "); Console.Write("Move the cursor with the arrow keys \nand confirm the selection with spacebar"); input = Console.ReadKey(); if (input.Key == ConsoleKey.UpArrow) { selectedRow = selectedRow - 1; } if (input.Key == ConsoleKey.DownArrow) { selectedRow = selectedRow + 1; } if (input.Key == ConsoleKey.LeftArrow) { selectedColumn = selectedColumn - 1; } if (input.Key == ConsoleKey.RightArrow) { selectedColumn = selectedColumn + 1; } selectedRow = CorrectOutOfBounds(selectedRow, gameBoardSize); selectedColumn = CorrectOutOfBounds(selectedColumn, gameBoardSize); ClearScreen(); Draw(gameBoard); } while (input.Key != ConsoleKey.Spacebar); }
public void TestSetPlayerNameWithEmptyString() { //Arrange Player TestPlayer = new Player(); string expectedPlayerName = "Player 1"; //Act TestPlayer.SetPlayerName("", 1); string actualPlayerName = TestPlayer.GetPlayerName(); //Assert Assert.AreEqual(actualPlayerName, expectedPlayerName); }
public void TestSetAndGetPlayerName_ValidInputs_CorrectResult() { //Arrange Player TestPlayer = new Player(); string expectedPlayerName = "Mr.Big"; //Act TestPlayer.SetPlayerName("Mr.Big",1); string actualPlayerName = TestPlayer.GetPlayerName(); //Assert Assert.IsTrue(actualPlayerName == expectedPlayerName); }
public void AnnounceTheWinner(Player pl) { Console.WriteLine(pl.GetPlayerName() + " is the WINNER"); }