Finition de deux tests pour gérer les pénalités sur les cases dangereuses ou ayant une valeure > 12
continuous-integration/drone/push Build is passing Details

pull/111/head
Remi NEVEU 11 months ago
parent c499d279c8
commit 49ee464ed2

@ -363,12 +363,38 @@ public class GameTests
[Fact] [Fact]
public void PutPenalty_ShouldPutPenalty() public void PutPenalty_ShouldPutPenalty()
{ {
var player = new Player("test_player", "DefaultProfilePicture");
var map = new Map("test_name", "test_background.png");
_game.InitializeGame(map, player);
_game.UsedMap.Boards[1].Value = 5;
var methodInfo = typeof(Game).GetMethod("PlaceResult", BindingFlags.NonPublic | BindingFlags.Instance);
Assert.NotNull(methodInfo);
var cell = new Cell(0, 2);
cell.Value = 14;
methodInfo.Invoke(_game, new object[] { cell, 14 });
Assert.True(_game.UsedMap.Boards[2].Penalty);
}
[Fact]
public void PutPenalty_ShouldPutPenalty_ForDangerous()
{
var player = new Player("test_player", "DefaultProfilePicture");
var map = new Map("test_name", "test_background.png");
_game.InitializeGame(map, player);
_game.UsedMap.Boards[1].Value = 5;
_game.UsedMap.Boards[2].IsDangerous = true;
var methodInfo = typeof(Game).GetMethod("PlaceResult", BindingFlags.NonPublic | BindingFlags.Instance);
Assert.NotNull(methodInfo);
var cell = new Cell(0, 2);
cell.Value = 7;
methodInfo.Invoke(_game, new object[] { cell, 7 });
Assert.True(_game.UsedMap.Boards[2].Penalty);
}
Game game = new Game();
Player player = new Player("test", "DefaultProfilePicture");
Cell cell = new Cell(0, 0);
game.AddPlayer(player);
game.PlaceResult(cell, 14);
Assert.True(player.Penalty);
}}
} }

Loading…
Cancel
Save