test issue #1
continuous-integration/drone/push Build is passing Details

master
Jules LASCRET 11 months ago
parent 20323c92b5
commit 4cc3b3361d

@ -7,7 +7,6 @@ using QwirkleClassLibrary.Events;
using QwirkleClassLibrary.Players; using QwirkleClassLibrary.Players;
using System.ComponentModel; using System.ComponentModel;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using static System.Formats.Asn1.AsnWriter;
namespace QwirkleClassLibrary.Games namespace QwirkleClassLibrary.Games
{ {
@ -559,7 +558,7 @@ namespace QwirkleClassLibrary.Games
/// <param name="nbTiles"></param> /// <param name="nbTiles"></param>
/// <param name="checkdoubles"></param> /// <param name="checkdoubles"></param>
/// <returns></returns> /// <returns></returns>
public static bool CheckTileInCompletedLines(Tile? t1, ref int nbTiles, ref List<Tile> checkdoubles) public bool CheckTileInCompletedLines(Tile? t1, ref int nbTiles, ref List<Tile> checkdoubles)
{ {
if (t1! != null!) if (t1! != null!)
{ {
@ -587,7 +586,7 @@ namespace QwirkleClassLibrary.Games
/// <param name="b"></param> /// <param name="b"></param>
/// <param name="checkdoubles"></param> /// <param name="checkdoubles"></param>
/// <returns></returns> /// <returns></returns>
public static bool CheckWrongCompletedLines(int x, int y, int dx, int dy, Board b, ref List<Tile> checkdoubles) public bool CheckWrongCompletedLines(int x, int y, int dx, int dy, Board b, ref List<Tile> checkdoubles)
{ {
int nbTiles = 1; int nbTiles = 1;

@ -62,7 +62,7 @@ namespace QwirkleClassLibrary.Tiles
{ {
if (obj == null) if (obj == null)
{ {
throw new NullReferenceException("The object is null."); return 1;
} }
var otherTile = obj as Tile; var otherTile = obj as Tile;

@ -384,7 +384,7 @@ public class TestGame
[Fact] [Fact]
public void Test_CheckTileInCompletedLines() public void Test_CheckTileInCompletedLines()
{ {
var game = new Game();
int nbTiles = 0; int nbTiles = 0;
var checkdoubles = new List<Tile>() var checkdoubles = new List<Tile>()
{ {
@ -395,19 +395,17 @@ public class TestGame
var t1 = new Tile(Shape.Club, Color.Green); 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] [Fact]
public void Test_CheckWrongCompletedLines() public void Test_CheckWrongCompletedLines()
{ {
// Arrange
var game = new Game(); var game = new Game();
var board = new Board(17, 14); var board = new Board(17, 14);
var checkDoubles = new List<Tile>(); var checkDoubles = new List<Tile>();
int x = 4, y = 1, dx = 1, dy = 0; 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(1, 1, new Tile(Shape.Club, Color.Red));
board.AddTileInCell(2, 1, new Tile(Shape.Square, Color.Red)); board.AddTileInCell(2, 1, new Tile(Shape.Square, Color.Red));
board.AddTileInCell(3, 1, new Tile(Shape.Star, Color.Red)); board.AddTileInCell(3, 1, new Tile(Shape.Star, Color.Red));
@ -415,10 +413,8 @@ public class TestGame
board.AddTileInCell(6, 1, new Tile(Shape.Shuriken, Color.Red)); board.AddTileInCell(6, 1, new Tile(Shape.Shuriken, Color.Red));
board.AddTileInCell(7, 1, new Tile(Shape.Rhombus, Color.Red)); board.AddTileInCell(7, 1, new Tile(Shape.Rhombus, Color.Red));
// Act bool result = game.CheckWrongCompletedLines(x, y, dx, dy, board, ref checkDoubles);
bool result = Game.CheckWrongCompletedLines(x, y, dx, dy, board, ref checkDoubles);
// Assert
Assert.False(result); Assert.False(result);
} }

Loading…
Cancel
Save