|
|
|
@ -1,3 +1,4 @@
|
|
|
|
|
using QwirkleClassLibrary.Boards;
|
|
|
|
|
using QwirkleClassLibrary.Games;
|
|
|
|
|
using QwirkleClassLibrary.Players;
|
|
|
|
|
namespace TestBase;
|
|
|
|
@ -9,11 +10,13 @@ public class TestGame
|
|
|
|
|
[Theory]
|
|
|
|
|
[InlineData(true, false, "testt")]
|
|
|
|
|
[InlineData(false, false, "testt")]
|
|
|
|
|
[InlineData(false, true, "testt")]
|
|
|
|
|
public void Test_GameAddPlayerIngame(bool result, bool gamestate, string p)
|
|
|
|
|
{
|
|
|
|
|
Game game = new Game();
|
|
|
|
|
|
|
|
|
|
if (!result) {
|
|
|
|
|
if (!result)
|
|
|
|
|
{
|
|
|
|
|
game.AddPlayerInGame(p);
|
|
|
|
|
Assert.False(game.AddPlayerInGame(p));
|
|
|
|
|
}
|
|
|
|
@ -24,13 +27,10 @@ public class TestGame
|
|
|
|
|
|
|
|
|
|
if (gamestate)
|
|
|
|
|
{
|
|
|
|
|
game.StartGame();
|
|
|
|
|
Assert.False(game.AddPlayerInGame(p));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Theory]
|
|
|
|
@ -122,6 +122,41 @@ public class TestGame
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Fact]
|
|
|
|
|
public void Test_BoardReturn()
|
|
|
|
|
{
|
|
|
|
|
Game game = new Game();
|
|
|
|
|
Assert.IsType<Board>(game.GetBoard());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Fact]
|
|
|
|
|
public void Test_EmptyCell()
|
|
|
|
|
{
|
|
|
|
|
Game game = new Game();
|
|
|
|
|
Board b = game.GetBoard();
|
|
|
|
|
Cell? c = b.GetCell(1, 1);
|
|
|
|
|
|
|
|
|
|
game.AddCellUsed(c);
|
|
|
|
|
|
|
|
|
|
game.EmptyCellUsed();
|
|
|
|
|
|
|
|
|
|
Assert.Empty(game.CellsUsed);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Fact]
|
|
|
|
|
public void Test_TileOfPlayer()
|
|
|
|
|
{
|
|
|
|
|
Game game = new Game();
|
|
|
|
|
game.AddPlayerInGame("Test1");
|
|
|
|
|
game.AddPlayerInGame("Test2");
|
|
|
|
|
|
|
|
|
|
game.StartGame();
|
|
|
|
|
game.SetFirstPlayer();
|
|
|
|
|
|
|
|
|
|
game.GiveTilesToPlayers();
|
|
|
|
|
|
|
|
|
|
Assert.Equal(game.PlayerList[0].Tiles[0], game.TileOfPlayerWithPos(0));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|