public void CheckWinner_NoWinner_ReturnFalse() { PointIndex test = new PointIndex { X = 0, Y = 0 }; MatrixAlgorithm matrixAlgorithm = this.CreateInstance(); matrixAlgorithm.Board = new PlayerType[3, 3] { { PlayerType.X, PlayerType.O, PlayerType.X }, { PlayerType.X, PlayerType.O, PlayerType.X }, { PlayerType.O, PlayerType.X, PlayerType.O } }; Assert.That(() => matrixAlgorithm.CheckWinner(test, PlayerType.Unassigned), Is.False); }
public void CheckWinner_PlayerWinsWithDiagonalsFromLeftToRight_ReturnTrue() { PointIndex test = new PointIndex { X = 0, Y = 0 }; MatrixAlgorithm matrixAlgorithm = this.CreateInstance(); matrixAlgorithm.Board = new PlayerType[3, 3] { { PlayerType.X, PlayerType.Unassigned, PlayerType.Unassigned }, { PlayerType.Unassigned, PlayerType.X, PlayerType.Unassigned }, { PlayerType.Unassigned, PlayerType.Unassigned, PlayerType.X } }; Assert.That(() => matrixAlgorithm.CheckWinner(test, PlayerType.X), Is.True); }
public void CheckWinner_GameEndsWithDraw_ReturnTrue() { PointIndex test = new PointIndex { X = 0, Y = 0 }; MatrixAlgorithm matrixAlgorithm = this.CreateInstance(); matrixAlgorithm.Board = new PlayerType[3, 3] { { PlayerType.X, PlayerType.X, PlayerType.O }, { PlayerType.O, PlayerType.O, PlayerType.X }, { PlayerType.X, PlayerType.O, PlayerType.X } }; matrixAlgorithm.CurrentTurnCount = 8; Assert.That(() => matrixAlgorithm.CheckWinner(test, PlayerType.X), Is.True); }