public void PlayerTestToString()
 {
     Player player = new Player("mimi", 123);
     string expected = "mimi --> 123";
     string actual = player.ToString();
     Assert.AreEqual(expected, actual, "ToString not working correctly");
 }
        /// <summary>
        /// Adds a top score.
        /// </summary>
        /// <param name="player">The player that achieved the score.</param>
        public void AddTopScore(Player player)
        {
            if (player == null)
            {
                throw new ArgumentNullException("The player cannot be null");
            }

            if (this.topPlayers.Capacity > this.topPlayers.Count)
            {
                this.topPlayers.Add(player);
                this.topPlayers.Sort();
            }
            else
            {
                this.topPlayers.RemoveAt(this.topPlayers.Capacity - 1);
                this.topPlayers.Add(player);
                this.topPlayers.Sort();
            }
        }
        /// <summary>
        /// Processes the score by adding it to the top scores if necessary.
        /// </summary>
        /// <param name="name">The player name.</param>
        /// <param name="score">The player score.</param>
        public void ProcessScore(string name, int score)
        {
            if (score < 0)
            {
                throw new ArgumentException("The player score cannot be negative");
            }

            if (this.IsHighScore(score))
            {
                Player player = new Player(name, score);
                this.AddTopScore(player);
            }
        }
 public void PlayerTestNullName()
 {
     Player player = new Player(null, 14);
 }
 public void PlayerTestGetName()
 {
     Player player = new Player("gosho", 14);
     Assert.AreEqual("gosho", player.Name, "The player class is not being instantiated as expected!");
 }
 public void PlayerTestConstructor()
 {
     Player first = new Player("a", -12);
 }
 public void PlayerTestCompareToExpectedException()
 {
     Player player = new Player("a", 12);
     player.CompareTo(12);
 }
 public void PlayerTestCompareTo2()
 {
     Player first = new Player("a", 12);
     Player second = new Player("b", 120);
     Assert.AreEqual(1, first.CompareTo(second), "CompareTo not working correctly");
 }