From a82aa56f56f82048cfef0a2317359287906014c7 Mon Sep 17 00:00:00 2001 From: "jeremy.mouyon" Date: Thu, 23 May 2024 19:58:14 +0200 Subject: [PATCH] ... --- Qwirkle/QwirkleClassLibrary/Games/Game.cs | 12 ++++++------ Qwirkle/TestBase/TestGame.cs | 7 ++++--- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/Qwirkle/QwirkleClassLibrary/Games/Game.cs b/Qwirkle/QwirkleClassLibrary/Games/Game.cs index 50a5c80..4a82dd7 100644 --- a/Qwirkle/QwirkleClassLibrary/Games/Game.cs +++ b/Qwirkle/QwirkleClassLibrary/Games/Game.cs @@ -58,6 +58,12 @@ namespace QwirkleClassLibrary.Games /// boolean to check it public bool AddPlayerInGame(List PlayersTag) { + if (GameRunning) + { + OnPlayerNotified(new AddPlayerNotifiedEventArgs("ERROR : The game is running.")); + return false; + } + for (int i = PlayersTag.Count - 1; i >= 0; i--) { if (string.IsNullOrWhiteSpace(PlayersTag[i])) @@ -100,12 +106,6 @@ namespace QwirkleClassLibrary.Games return false; } - if (GameRunning) - { - OnPlayerNotified(new AddPlayerNotifiedEventArgs("ERROR with " + (pos + 1) + " entry : The game is running.")); - return false; - } - for(int i=0; i players = [p1, p2]; + List players2 = ["patrick", "jeanclaude"]; if (!result) { @@ -29,8 +29,9 @@ public class TestGame if (gamestate) { + game.AddPlayerInGame(players); game.StartGame(); - Assert.False(game.AddPlayerInGame(players)); + Assert.False(game.AddPlayerInGame(players2)); } }