//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")); }
public void Save_InputFile_NoExceptionThrown() { string path = Path.Combine(Directory.GetCurrentDirectory(), "tests/HSSave.txt"); 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)); hiScore.HiScores.Sort(HighScores.CompareHighScores); try { hiScore.Save(path); } catch (Exception e) { Assert.Fail(); } HighScores score = HighScores.Load(path); Assert.IsTrue(score.Equals(hiScore)); }