You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
sae201_qwirkle/Qwirkle/TestBase/TestTileBag.cs

63 lines
1.2 KiB

using QwirkleClassLibrary.Tiles;
namespace TestBase;
public class TestTileBag
{
[Theory]
[InlineData(false, 5)]
[InlineData(false, -5)]
[InlineData(true, 2)]
public void Test_TileBagConstructor(bool isValid, int nbset)
{
if (!isValid)
{
Assert.Throws<ArgumentException>(() => new TileBag(nbset));
return;
}
TileBag bag = new TileBag(nbset);
Assert.Equal(bag.TilesBag.Count, nbset*36);
}
[Fact]
public void Test_AddTileInBag()
{
Tile? t = null;
Tile tok = new(Shape.Club, Color.Green);
TileBag bag = new TileBag(2);
if (t != null && bag.AddTileInBag(t) == false)
{
Assert.True(bag.AddTileInBag(tok));
}
}
[Theory]
[InlineData(true)]
[InlineData(false)]
public void Test_RemoveTileInBag(bool except)
{
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;
}
}