More tests and code smell fix (starting to feel bored)
continuous-integration/drone/push Build is passing Details

master
Jules LASCRET 11 months ago
parent 9ea98eaa90
commit 20323c92b5

@ -587,7 +587,7 @@ namespace QwirkleClassLibrary.Games
/// <param name="b"></param>
/// <param name="checkdoubles"></param>
/// <returns></returns>
private static bool CheckWrongCompletedLines(int x, int y, int dx, int dy, Board b, ref List<Tile> checkdoubles)
public static bool CheckWrongCompletedLines(int x, int y, int dx, int dy, Board b, ref List<Tile> checkdoubles)
{
int nbTiles = 1;

@ -398,6 +398,30 @@ public class TestGame
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));
// Act
bool result = Game.CheckWrongCompletedLines(x, y, dx, dy, board, ref checkDoubles);
// Assert
Assert.False(result);
}
[Theory]
[InlineData(3, 1, 4, 1, 5, 1, 5)]
[InlineData(2, 2, 3, 2, 4, 2, 5)]

Loading…
Cancel
Save