From 92adef32f4bc838c6ca1206c765e09524ec1e954 Mon Sep 17 00:00:00 2001 From: "jules.lascret" Date: Thu, 16 May 2024 16:29:20 +0200 Subject: [PATCH] fixed some code smelt --- Qwirkle/QwirkleClassLibrary/Score.cs | 2 +- Qwirkle/TestBase/TestBoard.cs | 4 ++-- Qwirkle/TestBase/TestScore.cs | 5 +++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Qwirkle/QwirkleClassLibrary/Score.cs b/Qwirkle/QwirkleClassLibrary/Score.cs index db38754..ff52f78 100644 --- a/Qwirkle/QwirkleClassLibrary/Score.cs +++ b/Qwirkle/QwirkleClassLibrary/Score.cs @@ -15,7 +15,7 @@ namespace QwirkleClassLibrary { if (p == null) { - throw new NullReferenceException("player"); + throw new ArgumentNullException(nameof(p), "player cannot be null"); } else { PlayerScore = 0; diff --git a/Qwirkle/TestBase/TestBoard.cs b/Qwirkle/TestBase/TestBoard.cs index f56f181..2ad505c 100644 --- a/Qwirkle/TestBase/TestBoard.cs +++ b/Qwirkle/TestBase/TestBoard.cs @@ -62,7 +62,7 @@ public class TestBoard { Board board = new Board(12, 12); - Assert.Equal((12 * 12), board.GetCells().Count()); + Assert.Equal((12 * 12), board.GetCells().Count); } [Fact] @@ -82,7 +82,7 @@ public class TestBoard } ReadOnlyCollection readCells = cells.AsReadOnly(); - Assert.Equal(readCells.Count(), board.GetReadCells().Count()); + Assert.Equal(readCells.Count, board.GetReadCells().Count); } diff --git a/Qwirkle/TestBase/TestScore.cs b/Qwirkle/TestBase/TestScore.cs index 0b98fc5..ea8efd2 100644 --- a/Qwirkle/TestBase/TestScore.cs +++ b/Qwirkle/TestBase/TestScore.cs @@ -8,11 +8,12 @@ public class TestScore //[InlineData(true)] public void Test_CellScoreConstructor(bool except) { - /*if (!except) + if (!except) { Assert.Throws(() => new Score(null)); return; - }*/ + } + Player? p = new Player("test"); Score score = new Score(p); Assert.True(true);