public AddPlayer ( PlayerScore score ) : void | ||
score | PlayerScore | An instance of a class that implements the PlayerScore interface. |
return | void |
public void AddPlayer(PlayerScore score)
{
this.table.Add(score);
this.table.Sort();
if (this.table.Count > HighscoreTable.MaxPlayers)
{
this.table.RemoveAt(this.table.Count - 1);
}
}
public void AddingPlayerToHighscoreTableShouldWorkCorrectly() { HighscoreTable table = new HighscoreTable(); PlayerScore somePlayer = new PlayerScore("Pesho", 10, DateTime.Now); table.AddPlayer(somePlayer); Assert.AreEqual(1, table.Table.Count); }