public void HorizantalWinningRuleFails_WhenNoneOfTheRowInTheTicTacToeHasSamePlayerSymbol() { IBoard board = MockRepository.GenerateMock<IBoard>(); char[] horizantalWinningBoardPositions = { '0', 'X', 'Y', 'X', 'X', 'Y', 'X', 'X', 'Y', 'X' }; ; board.Stub(b => b.BoardPositions).Return(horizantalWinningBoardPositions); var horizantalWinningRule = new HorizantalWinningRule(board); Assert.IsFalse(horizantalWinningRule.Apply()); }
public void HorizantalWinningRulePasses_WhenAnyRowInTheTicTacToeHasSamePlayerSymbol() { IBoard board = MockRepository.GenerateMock<IBoard>(); char[] horizantalWinningBoardPositions = { '0', 'X', 'X', 'X', '4', '5', '6', '7', '8', '9' }; ; board.Stub(b => b.BoardPositions).Return(horizantalWinningBoardPositions); var horizantalWinningRule = new HorizantalWinningRule(board); Assert.IsTrue(horizantalWinningRule.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); }