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/UnitTest1.cs

65 lines
1.4 KiB

using QwirkleClassLibrary;
namespace TestBase
{
public class TestPlayers
{
[Theory]
[InlineData(true, "Mathis")]
[InlineData(false, null)]
public void Test_CreatePlayer(bool isValid, string playertag)
{
if (!isValid)
{
Assert.Throws<ArgumentNullException>(() => new Player(playertag));
return;
}
Player player = new Player(playertag);
Assert.Equal(playertag, player.NameTag);
}
[Fact]
public void Test_AddTilePlayer()
{
Player p = new Player("cobaye");
Tile tile = new Tile(Shape.Round, Color.Orange);
p.AddTileToPlayer(tile);
bool r = false;
for(int i = 0; i < p.Tiles.Count; i++)
{
if (p.Tiles[i] == tile)
{
r = true;
}
}
Assert.True(r);
}
[Fact]
public void Test_RemoveilePlayer()
{
Player p = new Player("cobaye");
Tile tile = new Tile(Shape.Round, Color.Orange);
p.RemoveTileToPlayer(tile);
bool r = true;
for (int i = 0; i < p.Tiles.Count; i++)
{
if (p.Tiles[i] == tile)
{
r = false;
}
}
Assert.True(r);
}
}
}