|
|
|
@ -287,25 +287,6 @@ public class TestGame
|
|
|
|
|
Assert.False(game.PlaceTile(game.GetPlayingPlayer(), game.PlayerList[game.GetPlayingPlayerPosition()].Tiles[0], -5, 1));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// [Fact]
|
|
|
|
|
// public void Test_DrawTile()
|
|
|
|
|
// {
|
|
|
|
|
// Game game = new Game();
|
|
|
|
|
// game.AddPlayerInGame("Test1");
|
|
|
|
|
// game.AddPlayerInGame(playerstest);
|
|
|
|
|
//
|
|
|
|
|
// game.StartGame();
|
|
|
|
|
// game.SetNextPlayer();
|
|
|
|
|
//
|
|
|
|
|
// Assert.True(game.DrawTiles(game.GetPlayingPlayer()));
|
|
|
|
|
//
|
|
|
|
|
// /*test*/
|
|
|
|
|
// TileBag bag = new TileBag(0);
|
|
|
|
|
// Assert.False(game.DrawTiles(game.GetPlayingPlayer()));
|
|
|
|
|
// return;
|
|
|
|
|
//
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
[Theory]
|
|
|
|
|
[InlineData(true)]
|
|
|
|
|
[InlineData(false)]
|
|
|
|
@ -342,6 +323,48 @@ public class TestGame
|
|
|
|
|
Assert.Equal(p, events.Player);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Fact]
|
|
|
|
|
public void Test_IsTilePlacementCorrect()
|
|
|
|
|
{
|
|
|
|
|
var game = new Game();
|
|
|
|
|
var board = new Board(17, 14);
|
|
|
|
|
var tile = new Tile(Shape.Club, Color.Red);
|
|
|
|
|
|
|
|
|
|
board.AddTileInCell(0, 1, new Tile(Shape.Club, Color.Blue));
|
|
|
|
|
|
|
|
|
|
var x = 1;
|
|
|
|
|
var y = 1;
|
|
|
|
|
|
|
|
|
|
var surroundingCells = new List<Cell?>
|
|
|
|
|
{
|
|
|
|
|
board.GetCell(x + 1, y),
|
|
|
|
|
board.GetCell(x - 1, y),
|
|
|
|
|
board.GetCell(x, y + 1),
|
|
|
|
|
board.GetCell(x, y - 1)
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
bool result = game.IsTilePlacementCorrect(tile, x, y, board, surroundingCells);
|
|
|
|
|
|
|
|
|
|
Assert.True(result);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Fact]
|
|
|
|
|
public void Test_IsMoveCorrect()
|
|
|
|
|
{
|
|
|
|
|
var game = new Game();
|
|
|
|
|
var board = new Board(17, 14);
|
|
|
|
|
var tile = new Tile(Shape.Club, Color.Red);
|
|
|
|
|
|
|
|
|
|
board.AddTileInCell(0, 1, new Tile(Shape.Club, Color.Blue));
|
|
|
|
|
|
|
|
|
|
var x = 2;
|
|
|
|
|
var y = 1;
|
|
|
|
|
|
|
|
|
|
bool result = game.IsMoveCorrect(tile, x, y, board);
|
|
|
|
|
|
|
|
|
|
Assert.False(result);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Fact]
|
|
|
|
|
public void Test_IsMoveCorrectSixLine()
|
|
|
|
|
{
|
|
|
|
@ -384,7 +407,6 @@ public class TestGame
|
|
|
|
|
[Fact]
|
|
|
|
|
public void Test_CheckTileInCompletedLines()
|
|
|
|
|
{
|
|
|
|
|
var game = new Game();
|
|
|
|
|
int nbTiles = 0;
|
|
|
|
|
var checkdoubles = new List<Tile>()
|
|
|
|
|
{
|
|
|
|
@ -395,7 +417,7 @@ public class TestGame
|
|
|
|
|
|
|
|
|
|
var t1 = new Tile(Shape.Club, Color.Green);
|
|
|
|
|
|
|
|
|
|
Assert.False(game.CheckTileInCompletedLines(t1, ref nbTiles, ref checkdoubles));
|
|
|
|
|
Assert.False(Game.CheckTileInCompletedLines(t1, ref nbTiles, ref checkdoubles));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Fact]
|
|
|
|
|