public void FullGameDrawWinTest() { //Arrange GameTicTacToe game = new GameTicTacToe(); ActionResulting methodReturn = new ActionResulting(); Position positionTurn = new Position(); int[,] turns = { { 0, 0 }, { 1, 1 }, { 1, 0 }, { 2, 0 }, { 0, 2 }, { 0, 1 }, { 2, 1 }, { 1, 2 }, { 2, 2 } }; int numbersTurns = 9; //Act game.StartGame(); for (int i = 0; i < numbersTurns; i++) { positionTurn.x = turns[i, 0]; positionTurn.y = turns[i, 1]; methodReturn = MovementGameTicTacToe.MovimentGame(positionTurn, game.Player, game.Id.ToString()); game.Player = MovementGameTicTacToe.GetNextPlayer(game.Player); } //Assert Assert.IsTrue(methodReturn.StatusAction); Assert.AreEqual("Partida finalizada!", methodReturn.MessageAction); Assert.AreEqual("Draw", methodReturn.Winner); }
//подготовка к старту игры private void PreparationForTheStartOfTheGame() { this.Hide(); LoginForm loginForm = UserUpload(path); if (loginForm.ShowDialog() == DialogResult.OK) { LevelSetting(loginForm); playerName = loginForm.comboBoxSelectUser.Text; buttons = new Button[] { button0, button1, button2, button3, button4, button5, button6, button7, button8 }; bool isZero = loginForm.radioButtonZero.Checked; DetermineWhoPlaysWhat(isZero); game = new GameTicTacToe(level); game.ComputerMadeMove += Game_ComputerMadeMove; game.GameOver += Game_GameOver; LoadingSelectedData(); loginForm.Close(); this.Show(); NewGame(); } else { Application.Exit(); } }
public void StartsGameWithFirstPlayer() { //Arrange GameTicTacToe game = new GameTicTacToe(); ActionResulting methodReturn; //Act methodReturn = game.StartGame(); //Assert Assert.IsTrue(methodReturn.StatusAction); }
public void CheckCreatedFirstPlayer() { //Arrange GameTicTacToe game = new GameTicTacToe(); ActionResulting methodReturn; //Act methodReturn = game.StartGame(); //Assert if (methodReturn.StatusAction) { Assert.IsNotNull(game.Player); } }
public void TestGameTurn() { //Arrange GameTicTacToe game = new GameTicTacToe(); ActionResulting methodReturn; //Act game.StartGame(); methodReturn = MovementGameTicTacToe.MovimentGame(new Position { x = 0, y = 2 } , game.Player, game.Id.ToString()); //Assert Assert.IsTrue(methodReturn.StatusAction); }
public void GameNumberErrorTest() { //Arrange GameTicTacToe game = new GameTicTacToe(); ActionResulting methodReturn = new ActionResulting(); Position positionTurn = new Position(); //Act game.StartGame(); positionTurn.x = 1; positionTurn.y = 0; methodReturn = MovementGameTicTacToe.MovimentGame(positionTurn, game.Player, "guid-invalido-de-jogo"); //Assert Assert.IsFalse(methodReturn.StatusAction); Assert.AreEqual("Partida não encontrada", methodReturn.MessageAction); }
public void TurnErrorTest() { //Arrange GameTicTacToe game = new GameTicTacToe(); ActionResulting methodReturn = new ActionResulting(); Position positionTurn = new Position(); int[,] turns = { { 0, 0 }, { 1, 0 } }; int numbersTurns = 2; //Act game.StartGame(); for (int i = 0; i < numbersTurns; i++) { positionTurn.x = turns[i, 0]; positionTurn.y = turns[i, 1]; methodReturn = MovementGameTicTacToe.MovimentGame(positionTurn, game.Player, game.Id.ToString()); } //Assert Assert.IsFalse(methodReturn.StatusAction); Assert.AreEqual("Não é turno do jogador", methodReturn.MessageAction); }