public void DiagonalWinningRuleFails_WhenNoneOfTheDiagonals_InTheTicTacToeHasSamePlayerSymbol() { IBoard board = MockRepository.GenerateMock<IBoard>(); char[] diagonalBoardPositions = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' }; board.Stub(b => b.BoardPositions).Return(diagonalBoardPositions); var diagonalWinningRule = new DiagonalWinningRule(board); Assert.IsFalse(diagonalWinningRule.Apply()); }
public void DiagonalWinningRulePasses_WhenAnyDiagonal_InTheTicTacToeHasSamePlayerSymbol() { IBoard board = MockRepository.GenerateMock<IBoard>(); char[] diagonalBoardPositions = { '0', 'X', '2', '3', '4', 'X', '6', '7', '8', 'X' }; board.Stub(b => b.BoardPositions).Return(diagonalBoardPositions); var diagonalWinningRule = new DiagonalWinningRule(board); Assert.IsTrue(diagonalWinningRule.Apply()); }
private static void StartANewGame(List<IPlayer> players, Board board) { var diagonalWinningRule = new DiagonalWinningRule(board); var horizantalWinningRule = new HorizantalWinningRule(board); var verticalWinningRule = new VerticalWinningRule(board); var gameIsADrawRule = new GameIsADrawRule(board, diagonalWinningRule, horizantalWinningRule, verticalWinningRule); IResultsCheckingService resultsCheckingService = new ResultsCheckingService(gameIsADrawRule, diagonalWinningRule, horizantalWinningRule, verticalWinningRule); var game = new Game(board, resultsCheckingService); game.Play(players); }