diff --git a/Qwirkle/QwirkleClassLibrary/Games/Game.cs b/Qwirkle/QwirkleClassLibrary/Games/Game.cs index 07d0050..9c9c078 100644 --- a/Qwirkle/QwirkleClassLibrary/Games/Game.cs +++ b/Qwirkle/QwirkleClassLibrary/Games/Game.cs @@ -1,13 +1,5 @@ -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Xml.Linq; +using System.Collections.ObjectModel; using System.Security.Cryptography; -using System.Collections; -using System.Collections.Immutable; using System.Runtime.Serialization; using QwirkleClassLibrary.Tiles; using QwirkleClassLibrary.Boards; @@ -270,7 +262,7 @@ namespace QwirkleClassLibrary.Games { if (bag != null && p.Tiles.Count < 6) { - int val = RandomNumberGenerator.GetInt32(0, bag.TilesBag.Count); + int val = RandomNumberGenerator.GetInt32(0, bag.TilesBag!.Count); p.AddTileToPlayer(bag.TilesBag[val]); bag.RemoveTileInBag(bag.TilesBag[val]); @@ -362,7 +354,7 @@ namespace QwirkleClassLibrary.Games { while (player.Tiles.Count < 6) { - if (bag!.TilesBag.Count == 0) + if (bag!.TilesBag!.Count == 0) { return false; } @@ -396,7 +388,7 @@ namespace QwirkleClassLibrary.Games return false; } - if (bag!.TilesBag.Count < tilesToSwap.Count) + if (bag!.TilesBag!.Count < tilesToSwap.Count) { OnSwapTiles(new SwapTilesNotifiedEventArgs("Not enough tiles in the bag to swap !")); return false; @@ -733,7 +725,7 @@ namespace QwirkleClassLibrary.Games { List playerTilesBagPos = []; - if (bag!.TilesBag.Count == 0) + if (bag!.TilesBag!.Count == 0) { for (int i = 0; i < players.Count; i++) { @@ -785,7 +777,7 @@ namespace QwirkleClassLibrary.Games { List playerTilesBagPos = CheckTilesBag(); - if (playerTilesBagPos.Count != 0 && !CheckPlacementPossibilities(playerTilesBagPos) || bag!.TilesBag.Count == 0 && players[GetPlayingPlayerPosition()].Tiles.Count==0) + if (playerTilesBagPos.Count != 0 && !CheckPlacementPossibilities(playerTilesBagPos) || bag!.TilesBag!.Count == 0 && players[GetPlayingPlayerPosition()].Tiles.Count==0) { OnEndOfGame(new EndOfGameNotifiedEventArgs(player)); GameRunning = false; diff --git a/Qwirkle/TestBase/TestPlayer.cs b/Qwirkle/TestBase/TestPlayer.cs index fbf2147..1727423 100644 --- a/Qwirkle/TestBase/TestPlayer.cs +++ b/Qwirkle/TestBase/TestPlayer.cs @@ -11,10 +11,10 @@ public class TestPlayers { if (!isValid) { - Assert.Throws(() => new Player(playertag)); + Assert.Throws(() => new Player(playertag!)); return; } - Player player = new Player(playertag); + Player player = new Player(playertag!); Assert.Equal(playertag, player.NameTag); } diff --git a/Qwirkle/TestBase/TestTileBag.cs b/Qwirkle/TestBase/TestTileBag.cs index cbfc07b..e202809 100644 --- a/Qwirkle/TestBase/TestTileBag.cs +++ b/Qwirkle/TestBase/TestTileBag.cs @@ -16,7 +16,7 @@ public class TestTileBag return; } TileBag bag = new TileBag(nbset); - Assert.Equal(bag.TilesBag.Count, nbset * 36); + Assert.Equal(bag.TilesBag!.Count, nbset * 36); } @@ -30,11 +30,11 @@ public class TestTileBag if (except) { - Assert.True(bag.RemoveTileInBag(bag.TilesBag[1])); + Assert.True(bag.RemoveTileInBag(bag.TilesBag![1])); return; } - Tile tile = bag.TilesBag[0]; + Tile tile = bag.TilesBag![0]; bag.RemoveTileInBag(tile); Assert.False(bag.RemoveTileInBag(tile));