From 98d7abd2547942b646f435bb60b6d806e4485357 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20LAVERGNE?= Date: Tue, 28 May 2024 16:18:32 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9A=99=EF=B8=8F=20Ajout=20du=20d=C3=A9but=20?= =?UTF-8?q?des=20tests=20des=20R=C3=A8gles?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/Trek-12/Tests/RulesTests.cs | 39 ++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 source/Trek-12/Tests/RulesTests.cs diff --git a/source/Trek-12/Tests/RulesTests.cs b/source/Trek-12/Tests/RulesTests.cs new file mode 100644 index 0000000..2994420 --- /dev/null +++ b/source/Trek-12/Tests/RulesTests.cs @@ -0,0 +1,39 @@ +namespace Tests; +using Models.Game; +using Models.Rules; + +public class RulesTests +{ + [Fact] + public void IsCellEmpty_ReturnsTrue_WhenCellIsNull() + { + Rules rules = new Rules(); + Assert.True(rules.IsCellEmpty(null)); + } + + [Fact] + public void IsCellEmpty_ReturnsTrue_WhenCellValueIsNull() + { + Rules rules = new Rules(); + Cell cell = new Cell(0, 0); + Assert.True(rules.IsCellEmpty(cell)); + } + + [Fact] + public void IsCellEmpty_ReturnsFalse_WhenCellValueIsNotNull() + { + Rules rules = new Rules(); + Cell cell = new Cell(0, 0); + cell.Value = 1; + Assert.False(rules.IsCellEmpty(cell)); + } + + [Fact] + public void IsCellValid_ReturnsTrue_WhenCellIsEmptyAndHasAdjacentCells() + { + Rules rules = new Rules(); + Map map = new Map("background"); + Cell selectedCell = map.Boards[0]; + Assert.True(rules.IsCellValid(selectedCell, map.Boards)); + } +} \ No newline at end of file