diff --git a/Qwirkle/QwirkleClassLibrary/Tiles/TileBag.cs b/Qwirkle/QwirkleClassLibrary/Tiles/TileBag.cs index d23bac4..57cf565 100644 --- a/Qwirkle/QwirkleClassLibrary/Tiles/TileBag.cs +++ b/Qwirkle/QwirkleClassLibrary/Tiles/TileBag.cs @@ -24,32 +24,19 @@ namespace QwirkleClassLibrary.Tiles throw new ArgumentException(nbSet.ToString()); } - // for (int i = 0; i < nbSet; i++) - // { - // foreach (Shape s in Enum.GetValues(typeof(Shape))) - // { - // foreach (Color c in Enum.GetValues(typeof(Color))) - // { - // Tile t = new Tile(s, c); - // tiles.Add(t); - // } - // } - // } + for (int i = 0; i < nbSet; i++) + { + foreach (Shape s in Enum.GetValues(typeof(Shape))) + { + foreach (Color c in Enum.GetValues(typeof(Color))) + { + Tile t = new Tile(s, c); + tiles.Add(t); + } + } + } + - tiles.Add(new Tile(Shape.Club, Color.Blue)); - tiles.Add(new Tile(Shape.Club, Color.Green)); - tiles.Add(new Tile(Shape.Club, Color.Orange)); - tiles.Add(new Tile(Shape.Club, Color.Purple)); - tiles.Add(new Tile(Shape.Club, Color.Red)); - tiles.Add(new Tile(Shape.Club, Color.Yellow)); - - tiles.Add(new Tile(Shape.Round, Color.Blue)); - tiles.Add(new Tile(Shape.Round, Color.Green)); - tiles.Add(new Tile(Shape.Round, Color.Orange)); - tiles.Add(new Tile(Shape.Round, Color.Purple)); - tiles.Add(new Tile(Shape.Round, Color.Red)); - tiles.Add(new Tile(Shape.Round, Color.Yellow)); - TilesBag = tiles.AsReadOnly(); } diff --git a/Qwirkle/TestBase/TestGame.cs b/Qwirkle/TestBase/TestGame.cs index 33dbd2d..b72fd6c 100644 --- a/Qwirkle/TestBase/TestGame.cs +++ b/Qwirkle/TestBase/TestGame.cs @@ -130,6 +130,11 @@ public class TestGame public void Test_BoardReturn() { Game game = new Game(); + game.AddPlayerInGame("Test1"); + game.AddPlayerInGame("Test2"); + + game.StartGame(); + game.SetFirstPlayer(); Assert.IsType(game.GetBoard()); } @@ -137,14 +142,22 @@ public class TestGame public void Test_EmptyCell() { Game game = new Game(); - Board b = game.GetBoard(); - Cell? c = b.GetCell(1, 1); + + + game.AddPlayerInGame("Test1"); + game.AddPlayerInGame("Test2"); + + game.StartGame(); + game.SetFirstPlayer(); + + Board? b = game.GetBoard(); + Cell? c = b!.GetCell(1, 1); game.AddCellUsed(c); game.EmptyCellUsed(); - Assert.Empty(game.CellsUsed); + Assert.Equal(0, game.CellsUsed.Count); } [Fact] @@ -403,7 +416,6 @@ public class TestGame Assert.Empty(game.PlayerList); Assert.Null(game.GetTileBag()); - Assert.Null(game.GetBoard()); Assert.Equal(-1, game.GetPlayingPlayerPosition()); }