public void ExpectScoreNotToThrowWhenInitializedWithValidParameters()
        {
            Score score = new Score("Player", 10);
            string playerName = score.PlayerName;

            Assert.AreEqual(playerName, "Player");
        }
        public void ExpectToStringToReturnProperResult()
        {
            Score score = new Score("Player", 100);
            string expected = "Player 100";
            string actual = score.ToString();

            Assert.AreEqual(actual, expected);
        }
        public void TestIfOutputIsCorrectWithOneScore()
        {
            HighScore highScore = new HighScore();
            Score score = new Score("Player", 100);
            highScore.AddScore(score);

            string expected = "Top performers: \r\nPlayer 100\r\n";
            string actual = highScore.ToString();

            Assert.AreEqual(expected, actual);
        }
        /// <summary>
        /// A method used for adding scores to a scorelist.
        /// </summary>
        /// <param name="scoreToAdd">The parameter the method is called upon.</param>
        /// <exception cref="System.ArgumentNullException">An exception is thrown if 
        /// there is no score to add.</exception>
        public void AddScore(Score scoreToAdd)
        {
            if (scoreToAdd == null)
            {
                throw new ArgumentNullException(NullableScoreExMessage);
            }

            this.scoreList.Add(scoreToAdd.Points, scoreToAdd);

            if (this.scoreList.Count > MaxScoreCount)
            {
                this.scoreList.RemoveAt(MaxScoreCount);
            }
        }
        public void TestIfOutputIsCorrectWithSixScoresAndTheLastAddedIsBiggest()
        {
            HighScore highScore = new HighScore();

            for (int i = 1; i < 7; i++)
            {
                string name = String.Format("Player {0}", i);

                Score score = new Score(name, 100 * i);
                highScore.AddScore(score);
            }

            string expected = "Top performers: \r\nPlayer 6 600\r\nPlayer 5 500\r\nPlayer 4 400\r\nPlayer 3 300\r\nPlayer 2 200\r\n";
            string actual = highScore.ToString();

            Assert.AreEqual(expected, actual);
        }
 /// <summary>
 /// A constructor for the class.
 /// </summary>
 /// <param name="boardWidth">The board width the constructor uses.</param>
 /// <param name="boardHeight">The board height the constructor uses.</param>
 /// <param name="renderer">The interface passed to the constructor.</param>
 public Game(int boardWidth, int boardHeight, IRenderer renderer)
 {
     this.gameBoard = new Gameboard(boardWidth, boardHeight, new RecursivePopStrategy(), new NormalGravityStrategy());
     this.score = new Score("anonimous", 0);
     this.renderer = renderer;
 }
 public void ExpectScoreToThrowWhenInitializedWithShortName()
 {
     Score score = new Score("Pl", 10);
 }
 public void ExpectScoreToThrowWhenInitializedWithLongName()
 {
     Score score = new Score("Playerwithveryverylongname", 10);
 }
 public void ExpectScoreToThrowWhenInitializedWithInvalidPoints()
 {
     Score score = new Score("Player", -1);
 }
        public void TestIfOutputIsCorrectWithThreeScores()
        {
            HighScore highScore = new HighScore();

            for (int i = 1; i < 4; i++)
            {
                string name = String.Format("Player {0}", i);

                Score score = new Score(name, 100 * i);
                highScore.AddScore(score);
            }

            string expected = "Top performers: \r\nPlayer 3 300\r\nPlayer 2 200\r\nPlayer 1 100\r\n";
            string actual = highScore.ToString();

            Assert.AreEqual(expected, actual);
        }