commit de test

pull/111/head
Remi NEVEU 11 months ago
parent 7aa5f738c3
commit c499d279c8

@ -39,7 +39,12 @@ namespace Models.Game
/// Atribute to know if the cell is a penalty cell.
/// </summary>
[DataMember]
private bool Penalty { get; set; }
public bool Penalty { get; private set; }
public void SetPenalty()
{
Penalty = true;
}
/// <summary>
/// Constructor of the Cell class.

@ -287,6 +287,8 @@ namespace Models.Game
if (UsedMap.Boards[i].Value != null)
return false;
UsedMap.Boards[i].Value = result;
if ((UsedMap.Boards[i].IsDangerous && result > 6) || result > 12)
UsedMap.Boards[i].SetPenalty();
BoardUpdated?.Invoke(this, new BoardsUpdateEventArgs(UsedMap.Boards.ToList()));
return true;
}

@ -359,4 +359,16 @@ public class GameTests
game.AddPlayer(player);
Assert.False(game.RemovePlayer("otherName"));
}
[Fact]
public void PutPenalty_ShouldPutPenalty()
{
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