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 System.ComponentModel;
using System.Runtime.CompilerServices;
using static System.Formats.Asn1.AsnWriter;
namespace QwirkleClassLibrary.Games
{
@ -559,7 +558,7 @@ namespace QwirkleClassLibrary.Games
/// <param name="nbTiles"></param>
/// <param name="checkdoubles"></param>
/// <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!)
{
@ -587,7 +586,7 @@ namespace QwirkleClassLibrary.Games
/// <param name="b"></param>
/// <param name="checkdoubles"></param>
/// <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;

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

@ -384,7 +384,7 @@ public class TestGame
[Fact]
public void Test_CheckTileInCompletedLines()
{
var game = new Game();
int nbTiles = 0;
var checkdoubles = new List<Tile>()
{
@ -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<Tile>();
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);
}

Loading…
Cancel
Save