コード例 #1
0
 //This method is called when the game ends.
 public void GameOver()
 {
     //IsOver = true;
     //Timer.Stop();
     highScores.CheckNewScores(this);
     highScores.Save(Path.Combine(Directory.GetCurrentDirectory(), "Saves/HighScoreSave.txt"));
 }
コード例 #2
0
        public void CheckNewScores_LowerScore_AddsNothing()
        {
            Game       myGame  = new Game(false);
            HighScores hiScore = new HighScores(new List <HiScore>());

            hiScore.HiScores.Add(new HiScore("ben", 123));
            hiScore.HiScores.Add(new HiScore("act", 234));
            hiScore.HiScores.Add(new HiScore("deb", 345));
            hiScore.HiScores.Add(new HiScore("hess", 456));
            hiScore.HiScores.Add(new HiScore("dark", 567));
            hiScore.HiScores.Add(new HiScore("bluff", 678));
            hiScore.HiScores.Add(new HiScore("schaub", 789));
            hiScore.HiScores.Add(new HiScore("mcgee", 890));
            hiScore.HiScores.Add(new HiScore("knisely", 903));
            hiScore.HiScores.Add(new HiScore("watson", 1));
            myGame.Username = "******";
            myGame.Points   = 0;
            hiScore.CheckNewScores(myGame);
            Assert.IsFalse(hiScore.HiScores.Contains(new HiScore("Evisserate", 0)));
        }