diff --git a/source/Trek-12/Tests/RulesTests.cs b/source/Trek-12/Tests/RulesTests.cs index 2994420..3b6fe48 100644 --- a/source/Trek-12/Tests/RulesTests.cs +++ b/source/Trek-12/Tests/RulesTests.cs @@ -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)); + } } \ No newline at end of file