sonnarrr
continuous-integration/drone/push Build is passing Details

test_old_branch
Jérémy Mouyon 11 months ago
parent 4e3b12f2b9
commit 970de91dce

@ -1,19 +1,22 @@
using QwirkleClassLibrary.Boards;
using QwirkleClassLibrary.Games;
using QwirkleClassLibrary.Players;
namespace TestBase;
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));
}
}

@ -11,9 +11,8 @@ namespace TestBase;
public class TestLeaderboard
{
[Theory]
[InlineData(true)]
public void Test_LeaderboardAdd(bool except)
[Fact]
public void Test_LeaderboardAdd()
{
var leaderboard = new Leaderboard();
var game = new Game();
@ -29,6 +28,40 @@ public class TestLeaderboard
leaderboard.AddScoreInLead(game.ScoreBoard);
Assert.True(except);
Assert.True(true);
}
[Fact]
public void Test_LeaderboardAdd2()
{
var leaderboard = new Leaderboard();
var game = new Game();
game.AddPlayerInGame("Test1");
game.AddPlayerInGame("Test2");
game.StartGame();
game.SetFirstPlayer();
var tile = new Tile(Shape.Club, Color.Blue);
game.PlaceTile(game.GetPlayingPlayer(), tile, 1, 1);
leaderboard.AddScoreInLead(game.ScoreBoard);
var game2 = new Game();
game.AddPlayerInGame("Test1");
game.AddPlayerInGame("Test2");
game.StartGame();
game.SetFirstPlayer();
game.PlaceTile(game.GetPlayingPlayer(), tile, 1, 1);
leaderboard.AddScoreInLead(game.ScoreBoard);
Assert.Equal(2, leaderboard.LB[0].Victories);
}
}

Loading…
Cancel
Save