diff --git a/Qwirkle/QwirkleClassLibrary/Games/Game.cs b/Qwirkle/QwirkleClassLibrary/Games/Game.cs index 739efb5..d5e8d19 100644 --- a/Qwirkle/QwirkleClassLibrary/Games/Game.cs +++ b/Qwirkle/QwirkleClassLibrary/Games/Game.cs @@ -7,7 +7,6 @@ using QwirkleClassLibrary.Events; using QwirkleClassLibrary.Players; using System.ComponentModel; using System.Runtime.CompilerServices; -using static System.Formats.Asn1.AsnWriter; namespace QwirkleClassLibrary.Games { @@ -559,7 +558,7 @@ namespace QwirkleClassLibrary.Games /// /// /// - public static bool CheckTileInCompletedLines(Tile? t1, ref int nbTiles, ref List checkdoubles) + public bool CheckTileInCompletedLines(Tile? t1, ref int nbTiles, ref List checkdoubles) { if (t1! != null!) { @@ -587,7 +586,7 @@ namespace QwirkleClassLibrary.Games /// /// /// - public static bool CheckWrongCompletedLines(int x, int y, int dx, int dy, Board b, ref List checkdoubles) + public bool CheckWrongCompletedLines(int x, int y, int dx, int dy, Board b, ref List checkdoubles) { int nbTiles = 1; diff --git a/Qwirkle/QwirkleClassLibrary/Tiles/Tile.cs b/Qwirkle/QwirkleClassLibrary/Tiles/Tile.cs index 45bd8c6..4c72ccf 100644 --- a/Qwirkle/QwirkleClassLibrary/Tiles/Tile.cs +++ b/Qwirkle/QwirkleClassLibrary/Tiles/Tile.cs @@ -62,7 +62,7 @@ namespace QwirkleClassLibrary.Tiles { if (obj == null) { - throw new NullReferenceException("The object is null."); + return 1; } var otherTile = obj as Tile; diff --git a/Qwirkle/TestBase/TestGame.cs b/Qwirkle/TestBase/TestGame.cs index 5dd518e..6c5637a 100644 --- a/Qwirkle/TestBase/TestGame.cs +++ b/Qwirkle/TestBase/TestGame.cs @@ -384,7 +384,7 @@ public class TestGame [Fact] public void Test_CheckTileInCompletedLines() { - + var game = new Game(); int nbTiles = 0; var checkdoubles = new List() { @@ -395,30 +395,26 @@ public class TestGame var t1 = new Tile(Shape.Club, Color.Green); - Assert.False(Game.CheckTileInCompletedLines(t1, ref nbTiles, ref checkdoubles)); + Assert.False(game.CheckTileInCompletedLines(t1, ref nbTiles, ref checkdoubles)); } [Fact] public void Test_CheckWrongCompletedLines() { - // Arrange var game = new Game(); var board = new Board(17, 14); var checkDoubles = new List(); int x = 4, y = 1, dx = 1, dy = 0; - // Add tiles to the board board.AddTileInCell(1, 1, new Tile(Shape.Club, Color.Red)); board.AddTileInCell(2, 1, new Tile(Shape.Square, Color.Red)); board.AddTileInCell(3, 1, new Tile(Shape.Star, Color.Red)); board.AddTileInCell(5, 1, new Tile(Shape.Round, Color.Red)); board.AddTileInCell(6, 1, new Tile(Shape.Shuriken, Color.Red)); board.AddTileInCell(7, 1, new Tile(Shape.Rhombus, Color.Red)); + + bool result = game.CheckWrongCompletedLines(x, y, dx, dy, board, ref checkDoubles); - // Act - bool result = Game.CheckWrongCompletedLines(x, y, dx, dy, board, ref checkDoubles); - - // Assert Assert.False(result); }