|
|
|
@ -363,12 +363,38 @@ public class GameTests
|
|
|
|
|
[Fact]
|
|
|
|
|
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);
|
|
|
|
|
}}
|
|
|
|
|
}
|
|
|
|
|