test
continuous-integration/drone/push Build is failing Details

test_old_branch
Jérémy Mouyon 1 year ago
parent 99a09fdb40
commit 9d22b46d0f

@ -13,6 +13,10 @@ namespace QwirkleClassLibrary
public Score(Player p)
{
if(p == null)
{
throw new ArgumentException(p.ToString());
}
score = 0;
playerTag = p.NameTag;
}

@ -14,7 +14,7 @@ namespace QwirkleClassLibrary
public TileBag(int nbSet)
{
if (nbSet < 0 || nbSet < 3)
if (nbSet < 0 || nbSet > 3)
{
throw new ArgumentException(nbSet.ToString());
}
@ -35,7 +35,7 @@ namespace QwirkleClassLibrary
public bool AddTileInBag(Tile tile)
{
if (tiles == null)
if (tile == null)
{
return false;
}

@ -0,0 +1,11 @@
{
"profiles": {
"QwirkleConsoleApp": {
"commandName": "Project"
},
"WSL": {
"commandName": "WSL2",
"distributionName": ""
}
}
}

@ -1,8 +1,7 @@
using QwirkleClassLibrary;
namespace TestBase;
namespace TestBase
{
public class TestPlayers
public class TestPlayers
{
[Theory]
[InlineData(true, "Mathis")]
@ -61,5 +60,4 @@ namespace TestBase
}
Assert.True(r);
}
}
}
}

@ -0,0 +1,42 @@
using QwirkleClassLibrary;
namespace TestBase;
public class TestScore
{
public static IEnumerable<object[]> Data_Score()
{
yield return new object[]
{
true,
new Player("Test"),
};
yield return new object[]
{
false,
null,
};
}
[Theory]
[MemberData(nameof(Data_Score))]
public void Test_CellScoreConstructor(bool except, Player p)
{
if (!except)
{
Assert.Throws<ArgumentNullException>(() => new Score(p));
return;
}
Score score = new Score(p);
Assert.True(true);
}
}

@ -16,7 +16,7 @@ public class TestTileBag
return;
}
TileBag bag = new TileBag(nbset);
Assert.Equal(bag.TilesBag.Count, nbset);
Assert.Equal(bag.TilesBag.Count, nbset*36);
}
[Fact]
@ -33,5 +33,23 @@ public class TestTileBag
}
}
[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));
}
}
}

Loading…
Cancel
Save