⚙️ AjAjout de es tests sur les cellules adjacentes
continuous-integration/drone/push Build is passing Details

pull/74/head
Rémi LAVERGNE 11 months ago
parent 98d7abd254
commit 379c709589
No known key found for this signature in database
GPG Key ID: CA264B55E97FD220

@ -28,6 +28,16 @@ public class RulesTests
Assert.False(rules.IsCellEmpty(cell));
}
[Fact]
public void IsCellValid_ReturnsFalse_WhenCellIsNotEmptyAndHasAdjacentCells()
{
Rules rules = new Rules();
Map map = new Map("background");
Cell selectedCell = map.Boards[0];
selectedCell.Value = 5;
Assert.False(rules.IsCellValid(selectedCell, map.Boards));
}
[Fact]
public void IsCellValid_ReturnsTrue_WhenCellIsEmptyAndHasAdjacentCells()
{
@ -36,4 +46,31 @@ public class RulesTests
Cell selectedCell = map.Boards[0];
Assert.True(rules.IsCellValid(selectedCell, map.Boards));
}
[Fact]
public void IsCellAdjacent_ReturnsFalse_WhenCellsAreNotAdjacent()
{
Rules rules = new Rules();
Cell cell1 = new Cell(0, 0);
Cell cell2 = new Cell(2, 2);
Assert.False(rules.IsCellAdjacent(cell1, cell2));
}
[Fact]
public void IsCellAdjacent_ReturnsTrue_WhenCellsAreSideBySide()
{
Rules rules = new Rules();
Cell cell1 = new Cell(0, 0);
Cell cell2 = new Cell(0, 1);
Assert.True(rules.IsCellAdjacent(cell1, cell2));
}
[Fact]
public void IsCellAdjacent_ReturnsTrue_WhenCellsAreDiagonal()
{
Rules rules = new Rules();
Cell cell1 = new Cell(0, 0);
Cell cell2 = new Cell(1, 1);
Assert.True(rules.IsCellAdjacent(cell1, cell2));
}
}
Loading…
Cancel
Save