コード例 #1
0
        //set-up method to return a ranking obj with 4 scores in it
        public Ranking Setup()
        {
            Ranking rank   = new Ranking();
            Score   score1 = new Score(20);
            Score   score2 = new Score(15);
            Score   score3 = new Score(2);
            Score   score4 = new Score(15);

            rank.AddScore(score1);
            rank.AddScore(score2);
            rank.AddScore(score3);
            rank.AddScore(score4);
            return(rank);
        }
コード例 #2
0
        public void TestAddCorrectScore()
        {
            Ranking rank   = Setup();
            Score   score1 = new Score(20);

            rank.AddScore(score1);
            bool actual = rank.Scores.Contains(score1);

            Assert.AreEqual(true, actual, "Test ranking can add score");
        }
コード例 #3
0
        public void TestCheckScoreCount()
        {
            Ranking rank   = Setup();
            Score   score2 = new Score(15);
            Score   score3 = new Score(2);

            rank.AddScore(score2);
            rank.AddScore(score3);
            rank.AddScore(score2);
            rank.AddScore(score3);
            rank.AddScore(score2);
            rank.AddScore(score2);
            rank.AddScore(score3);
            rank.AddScore(score2);
            int num = rank.Scores.Count;

            bool actual = (num == 10);

            Assert.AreEqual(true, actual, "Test ranking can add score with score count above 10");
        }