|
|
|
@ -251,13 +251,17 @@ public class GameTests
|
|
|
|
|
Assert.NotNull(_game.GameRules);
|
|
|
|
|
_game.UsedMap.Boards[0].Value = 1;
|
|
|
|
|
_game.UsedMap.Boards[1].Value = 2;
|
|
|
|
|
_game.UsedMap.Boards[0].Valid = true;
|
|
|
|
|
_game.UsedMap.Boards[1].Valid = true;
|
|
|
|
|
_game.UsedMap.Boards[2].Valid = true;
|
|
|
|
|
|
|
|
|
|
var methodInfo = typeof(Game).GetMethod("PlaceResult", BindingFlags.NonPublic | BindingFlags.Instance);
|
|
|
|
|
Assert.NotNull(methodInfo);
|
|
|
|
|
|
|
|
|
|
var cell = new Cell(0, 2);
|
|
|
|
|
cell.Value = 3;
|
|
|
|
|
methodInfo.Invoke(_game, new object[] { cell, 3 });
|
|
|
|
|
_game.PlayerCell = new Cell(2, 0);
|
|
|
|
|
_game.PlayerCell.Value = 3;
|
|
|
|
|
methodInfo.Invoke(_game, new object[] { _game.PlayerCell });
|
|
|
|
|
//_game.UsedMap.Boards[2].Value = _game.PlayerCell.Value;
|
|
|
|
|
|
|
|
|
|
Assert.Equal(3, _game.UsedMap.Boards[2].Value);
|
|
|
|
|
}
|
|
|
|
@ -329,14 +333,16 @@ public class GameTests
|
|
|
|
|
var player = new Player("test_player", "DefaultProfilePicture");
|
|
|
|
|
var map = new Map("test_name", "test_background.png");
|
|
|
|
|
_game.InitializeGame(map, player, false);
|
|
|
|
|
_game.UsedMap.Boards[1].Valid = true;
|
|
|
|
|
_game.UsedMap.Boards[2].Valid = true;
|
|
|
|
|
_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 });
|
|
|
|
|
_game.PlayerCell = new Cell(2, 0);
|
|
|
|
|
_game.PlayerCell.Value = 14;
|
|
|
|
|
methodInfo.Invoke(_game, new object[] { _game.PlayerCell });
|
|
|
|
|
|
|
|
|
|
Assert.True(_game.UsedMap.Boards[2].Penalty);
|
|
|
|
|
}
|
|
|
|
@ -347,15 +353,19 @@ public class GameTests
|
|
|
|
|
var player = new Player("test_player", "DefaultProfilePicture");
|
|
|
|
|
var map = new Map("test_name", "test_background.png");
|
|
|
|
|
_game.InitializeGame(map, player, false);
|
|
|
|
|
|
|
|
|
|
_game.UsedMap.Boards[1].Valid = true;
|
|
|
|
|
_game.UsedMap.Boards[2].Valid = true;
|
|
|
|
|
|
|
|
|
|
_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 });
|
|
|
|
|
_game.PlayerCell = new Cell(2, 0);
|
|
|
|
|
_game.PlayerCell.Value = 7;
|
|
|
|
|
methodInfo.Invoke(_game, new object[] { _game.PlayerCell });
|
|
|
|
|
|
|
|
|
|
Assert.True(_game.UsedMap.Boards[2].Penalty);
|
|
|
|
|
}
|
|
|
|
@ -430,13 +440,15 @@ public class GameTests
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_game.UsedMap.Boards[0].Value = 0;
|
|
|
|
|
methodInfo.Invoke(_game, new object[] { _game.UsedMap.Boards[0], _game.GameRules.EveryAdjacentCells(_game.UsedMap.Boards[0], _game.UsedMap.Boards.ToList()) });
|
|
|
|
|
//methodInfo.Invoke(_game, new object[] { _game.UsedMap.Boards[0], _game.UsedMap.Boards.ToList() });
|
|
|
|
|
_game.UsedMap.Boards[1].Value = 1;
|
|
|
|
|
methodInfo.Invoke(_game, new object[] { _game.UsedMap.Boards[1], _game.GameRules.EveryAdjacentCells(_game.UsedMap.Boards[1], _game.UsedMap.Boards.ToList()) });
|
|
|
|
|
//methodInfo.Invoke(_game, new object[] { _game.UsedMap.Boards[1], _game.UsedMap.Boards.ToList() });
|
|
|
|
|
_game.UsedMap.Boards[2].Value = 2;
|
|
|
|
|
methodInfo.Invoke(_game, new object[] { _game.UsedMap.Boards[2], _game.GameRules.EveryAdjacentCells(_game.UsedMap.Boards[2], _game.UsedMap.Boards.ToList()) });
|
|
|
|
|
//methodInfo.Invoke(_game, new object[] { _game.UsedMap.Boards[2], _game.UsedMap.Boards.ToList() });
|
|
|
|
|
_game.UsedMap.Boards[3].Value = 5;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
methodInfo.Invoke(_game, new object[] { _game.UsedMap.Boards[2], _game.UsedMap.Boards.ToList() });
|
|
|
|
|
|
|
|
|
|
_game.PutPenaltyForLostCells(_game.UsedMap.Boards);
|
|
|
|
|
|
|
|
|
|
Assert.True(_game.UsedMap.Boards[3].Penalty);
|
|
|
|
@ -467,16 +479,16 @@ public class GameTests
|
|
|
|
|
var place = typeof(Game).GetMethod("PlaceResult", BindingFlags.NonPublic | BindingFlags.Instance);
|
|
|
|
|
Assert.NotNull(place);
|
|
|
|
|
|
|
|
|
|
var cell = new Cell(1, 4);
|
|
|
|
|
cell.Value = 7;
|
|
|
|
|
cell.Valid = true;
|
|
|
|
|
cell.IsDangerous = true;
|
|
|
|
|
place.Invoke(_game, new object[] { cell, 7 }); //One penalty
|
|
|
|
|
_game.PlayerCell = new Cell(4, 1);
|
|
|
|
|
_game.PlayerCell.Value = 7;
|
|
|
|
|
_game.PlayerCell.Valid = true;
|
|
|
|
|
_game.PlayerCell.IsDangerous = true;
|
|
|
|
|
place.Invoke(_game, new object[] { _game.PlayerCell }); //One penalty
|
|
|
|
|
|
|
|
|
|
var othercell = new Cell(1, 5);
|
|
|
|
|
cell.Value = 14;
|
|
|
|
|
cell.Valid = true;
|
|
|
|
|
place.Invoke(_game, new object[] { othercell, 14 });
|
|
|
|
|
_game.PlayerCell = new Cell(5, 1);
|
|
|
|
|
_game.PlayerCell.Value = 14;
|
|
|
|
|
_game.PlayerCell.Valid = true;
|
|
|
|
|
place.Invoke(_game, new object[] { _game.PlayerCell });
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach (var cells in _game.UsedMap.Boards.ToList())
|
|
|
|
|