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

test_old_branch
Jérémy Mouyon 11 months ago
parent 2de5474fee
commit 33e1194a69

@ -86,6 +86,47 @@ public class TestBoard
Assert.Equal(readCells.Count, board.GetReadCells().Count);
}
[Theory]
[InlineData(true)]
[InlineData(false)]
public void Test_GetOccupiedCase(bool except)
{
Board board = new Board(12, 12);
Tile tile = new Tile(Shape.Club, Color.Blue);
if (except)
{
board.AddTileInCell(1, 1, tile);
Assert.True(board.HasOccupiedCase());
return;
}
Assert.False(board.HasOccupiedCase());
return;
}
[Theory]
[InlineData(true)]
[InlineData(false)]
public void Test_GetCellPos(bool except)
{
Board board = new Board(12, 12);
if (except)
{
Cell? c = board.GetCell(1, 1);
Assert.Equal(board.GetCell(1,1), c);
return;
}
Assert.Null(board.GetCell(900, 900));
return;
}
}

@ -0,0 +1,34 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using QwirkleClassLibrary.Games;
using QwirkleClassLibrary.Players;
using QwirkleClassLibrary.Tiles;
namespace TestBase;
public class TestLeaderboard
{
[Theory]
[InlineData(true)]
public void Test_LeaderboardAdd(bool except)
{
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);
Assert.True(except);
}
}

@ -34,20 +34,27 @@ public class TestTileBag
}
[Fact]
public void Test_RemoveTileInBag()
[Theory]
[InlineData(true)]
[InlineData(false)]
public void Test_RemoveTileInBag(bool except)
{
Tile? t = null;
Tile tok = new(Shape.Club, Color.Green);
TileBag bag = new TileBag(2);
bag.AddTileInBag(tok);
if (t != null && bag.RemoveTileInBag(t) == false)
{
Assert.True(bag.RemoveTileInBag(tok));
TileBag bag = new TileBag(1);
if (except)
{
Assert.True(bag.RemoveTileInBag(bag.TilesBag[1]));
return;
}
Tile tile = bag.TilesBag[0];
bag.RemoveTileInBag(tile);
Assert.False(bag.RemoveTileInBag(tile));
return;
}

Loading…
Cancel
Save