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.
56 lines
1.1 KiB
56 lines
1.1 KiB
using QwirkleClassLibrary;
|
|
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 (bag.AddTileInBag(t) == false)
|
|
{
|
|
Assert.True(bag.AddTileInBag(tok));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
[Fact]
|
|
public void Test_RemoveTileInBag()
|
|
{
|
|
Tile t = null;
|
|
Tile tok = new(Shape.Club, Color.Green);
|
|
TileBag bag = new TileBag(2);
|
|
bag.AddTileInBag(tok);
|
|
|
|
if (bag.RemoveTileInBag(t) == false)
|
|
{
|
|
Assert.True(bag.RemoveTileInBag(tok));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|