diff --git a/Qwirkle/TestBase/TestGame.cs b/Qwirkle/TestBase/TestGame.cs index 8883d79..3e32c4f 100644 --- a/Qwirkle/TestBase/TestGame.cs +++ b/Qwirkle/TestBase/TestGame.cs @@ -1,6 +1,7 @@ using QwirkleClassLibrary.Boards; using QwirkleClassLibrary.Games; using QwirkleClassLibrary.Players; +using System.Runtime.CompilerServices; namespace TestBase; public class TestGame @@ -158,6 +159,47 @@ public class TestGame Assert.Equal(game.PlayerList[0].Tiles[0], game.TileOfPlayerWithPos(0)); } + [Theory] + [InlineData(true)] + [InlineData(false)] + public void Test_SetFirstPlayer(bool except) + { + Game game = new Game(); + game.AddPlayerInGame("Test1"); + game.AddPlayerInGame("Test2"); + + if (except) + { + game.StartGame(); + Assert.IsType(game.SetFirstPlayer()); + return; + } + + Assert.Throws(() => game.SetFirstPlayer()); + + } + + [Theory] + [InlineData(true)] + [InlineData(false)] + public void Test_Setnextplayer(bool except) + { + Game game = new Game(); + game.AddPlayerInGame("Test1"); + game.AddPlayerInGame("Test2"); + + if (except) + { + game.StartGame(); + game.SetNextPlayer(); + Assert.IsType(game.SetNextPlayer()); + return; + } + game.StartGame(); + Assert.Equal(game.SetNextPlayer(), game.SetFirstPlayer()); + return; + + } }