private void verifyPlaceASymbolToEmptySpaceThenSystemMustAcceptTheRequest(string[,] slots, string symbol, int row, int column, string expectedCurrentTurn) { var boardGame = new BoardGame { Slots = slots }; var canPlace = boardGame.Place(symbol, row, column); Assert.True(canPlace); Assert.Equal(expectedCurrentTurn, boardGame.CurrentTurn); Assert.Null(boardGame.GetWinner()); Assert.False(boardGame.IsDraw); }
public void TestGetWinner(int row1, int column1, int row2, int column2, int row3, int column3, BoardGamePlayerType?boardPlayerType) { var boardGame = new BoardGame(); var isX = (boardPlayerType == BoardGamePlayerType.X); boardGame.TakeSlot(isX: isX, row: row1, column: column1); boardGame.TakeSlot(isX: isX, row: row2, column: column2); boardGame.TakeSlot(isX: isX, row: row3, column: column3); var winner = boardGame.GetWinner(); var expected = Convert.ToString(boardPlayerType); Assert.Equal(winner, expected); }
public void PlaceXInEmptySlotWhenBoardHave_2X_2O_WithConnectedTogather() { var slots = new string[, ] { { "X", "O", null }, { "X", "O", null }, { null, null, null }, }; var boardGame = new BoardGame { Slots = slots }; var canPlace = boardGame.Place("X", 2, 0); Assert.True(canPlace); Assert.Equal("X", boardGame.GetWinner()); Assert.Equal(0, boardGame.OScore); Assert.Equal(1, boardGame.XScore); Assert.False(boardGame.IsDraw); }