public void Test1() { PlayGame(true, 3); // Human selects top left square ... viewModel.HumanMove(square1); Assert.AreEqual("Please wait, the computer is thinking ...", viewModel.Message); Assert.IsFalse(viewModel.IsGameOver); Assert.IsFalse(viewModel.IsHumanTurn); Assert.IsFalse(square1.IsHumanTurn); Assert.IsFalse(square1.IsEnabled); Assert.IsFalse(square1.HighLight); Assert.AreEqual("X", square1.Piece); }
private void PlayGame(bool humanFirst, int size, params ValueTuple <int, int>[] moves) { viewModel = new TicTacToeViewModel(); viewModel.AutoStartComputerMove = false; // Computer doesn't automatically start thinking about it's move when it's the computer's turn // so that we can examine the state of the system before the computer move starts // viewModel.StartNewGame(size, humanFirst); square1 = viewModel.FindSquare(0, 0); square2 = viewModel.FindSquare(0, 1); square3 = viewModel.FindSquare(0, 2); square4 = viewModel.FindSquare(1, 0); square5 = viewModel.FindSquare(1, 1); square6 = viewModel.FindSquare(1, 2); square7 = viewModel.FindSquare(2, 0); square8 = viewModel.FindSquare(2, 1); square9 = viewModel.FindSquare(2, 2); foreach (var move in moves) { viewModel.HumanMove(viewModel.FindSquare(move.Item1, move.Item2)); } }