|
|
@ -1,6 +1,8 @@
|
|
|
|
using QwirkleClassLibrary.Boards;
|
|
|
|
using QwirkleClassLibrary.Boards;
|
|
|
|
|
|
|
|
using QwirkleClassLibrary.Events;
|
|
|
|
using QwirkleClassLibrary.Games;
|
|
|
|
using QwirkleClassLibrary.Games;
|
|
|
|
using QwirkleClassLibrary.Players;
|
|
|
|
using QwirkleClassLibrary.Players;
|
|
|
|
|
|
|
|
using QwirkleClassLibrary.Tiles;
|
|
|
|
using System.Runtime.CompilerServices;
|
|
|
|
using System.Runtime.CompilerServices;
|
|
|
|
namespace TestBase;
|
|
|
|
namespace TestBase;
|
|
|
|
|
|
|
|
|
|
|
@ -195,11 +197,79 @@ public class TestGame
|
|
|
|
Assert.IsType<string>(game.SetNextPlayer());
|
|
|
|
Assert.IsType<string>(game.SetNextPlayer());
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
game.StartGame();
|
|
|
|
game.StartGame();
|
|
|
|
Assert.Equal(game.SetNextPlayer(), game.SetFirstPlayer());
|
|
|
|
Assert.Equal(game.SetNextPlayer(), game.SetFirstPlayer());
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[Theory]
|
|
|
|
|
|
|
|
[InlineData(true)]
|
|
|
|
|
|
|
|
[InlineData(false)]
|
|
|
|
|
|
|
|
public void Test_PlaceTile(bool except)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Game game = new Game();
|
|
|
|
|
|
|
|
game.AddPlayerInGame("Test1");
|
|
|
|
|
|
|
|
game.AddPlayerInGame("Test2");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
game.GiveTilesToPlayers();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (except)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
game.StartGame();
|
|
|
|
|
|
|
|
game.SetNextPlayer();
|
|
|
|
|
|
|
|
Assert.True(game.PlaceTile(game.GetPlayingPlayer(), game.PlayerList[game.GetPlayingPlayerPosition()].Tiles[0], 1, 1));
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
game.StartGame();
|
|
|
|
|
|
|
|
game.SetNextPlayer();
|
|
|
|
|
|
|
|
Assert.False(game.PlaceTile(game.GetPlayingPlayer(), game.PlayerList[game.GetPlayingPlayerPosition()].Tiles[0], -5, 1));
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[Fact]
|
|
|
|
|
|
|
|
public void Test_DrawTile()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Game game = new Game();
|
|
|
|
|
|
|
|
game.AddPlayerInGame("Test1");
|
|
|
|
|
|
|
|
game.AddPlayerInGame("Test2");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
game.StartGame();
|
|
|
|
|
|
|
|
game.SetNextPlayer();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Assert.True(game.DrawTiles(game.GetPlayingPlayer()));
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[Theory]
|
|
|
|
|
|
|
|
[InlineData(true)]
|
|
|
|
|
|
|
|
[InlineData(false)]
|
|
|
|
|
|
|
|
public void Test_SwapTiles(bool except)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Game game = new Game();
|
|
|
|
|
|
|
|
game.AddPlayerInGame("Test1");
|
|
|
|
|
|
|
|
game.AddPlayerInGame("Test2");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
game.StartGame();
|
|
|
|
|
|
|
|
game.SetNextPlayer();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<Tile> list = [];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (except)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
game.DrawTiles(game.GetPlayingPlayer());
|
|
|
|
|
|
|
|
list.Add(game.GetPlayingPlayer().Tiles[1]);
|
|
|
|
|
|
|
|
Assert.True(game.SwapTiles(game.GetPlayingPlayer(), list));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
Assert.False(game.SwapTiles(game.GetPlayingPlayer(), list));
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|