public void ToWinner_PlayerInput_ValidOutput(Player input, Winner expectedOutput) { // arrange // act Winner result = input.ToWinner(); // assert result.Should().Be(expectedOutput); }
public void GetWinner_EmptyBoard_ReturnsWinnerNone(Player lastPlayer) { // arrange SmallTileInformation[][] emptyBoard = GetEmptyBoard(); // act Winner winner = emptyBoard.GetWinner(lastPlayer); // assert winner.Should().Be(Winner.None); }
public void GetWinner_DiagonalBottomLeftToTopRightWinner_ReturnsCorrectWinner(Player p) { // arrange SmallTileInformation[][] board = GetEmptyBoard(); board[2][0].Value = p.ToTileValue(); board[1][1].Value = p.ToTileValue(); board[0][2].Value = p.ToTileValue(); // act Winner winner = board.GetWinner(p); // assert winner.Should().Be(p.ToWinner()); }
public void GetWinner_LinesVerticalWinner_ReturnsCorrectWinner(int y, Player p) { // arrange SmallTileInformation[][] board = GetEmptyBoard(); for (var x = 0; x < 3; x++) { board[x][y].Value = p.ToTileValue(); } // act Winner winner = board.GetWinner(p); // assert winner.Should().Be(p.ToWinner()); }
public void GetWinner_NoWinner_ReturnsCorrectWinner(Player p) { // arrange SmallTileInformation[][] board = GetEmptyBoard(); board[0][0].Value = TileValue.Cross; board[0][1].Value = TileValue.Empty; board[0][2].Value = TileValue.Cross; board[1][0].Value = TileValue.Circle; board[1][1].Value = TileValue.Empty; board[1][2].Value = TileValue.Circle; board[2][0].Value = TileValue.Empty; board[2][1].Value = TileValue.Cross; board[2][2].Value = TileValue.Circle; // act Winner winner = board.GetWinner(p); // assert winner.Should().Be(Winner.None); }