Beispiel #1
0
        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));
        }
Beispiel #2
0
        public Game(bool isCheat)
        {
            IsCheat         = isCheat;
            IsOver          = false;
            Random          = new Random();
            ViewCamera      = new Camera(this);
            Points          = 0;
            Ticks           = 0;
            HorizontalInput = 0;
            VerticalInput   = 0;
            WellSpawnFreq   = 400;
            WellDestabFreq  = 4000;
            StableWells     = new List <Well>();
            UnstableWells   = new List <Well>();
            AIShips         = new List <AIShip>();
            Orbs            = new List <Orb>();
            GameObjects     = new List <GameObject>();

            highScores = HighScores.Load(Path.Combine(Directory.GetCurrentDirectory(), "Saves/HighScoreSave.txt"));
        }
Beispiel #3
0
        public void Load_InputFile_ReturnsHighScoresObject()
        {
            string path = Path.Combine(Directory.GetCurrentDirectory(), "tests/HSLoad.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);

            HighScores score = HighScores.Load(path);

            Assert.IsTrue(score.Equals(hiScore));
        }
Beispiel #4
0
 public HighScorePage(Page parentPage)
 {
     ParentPage = parentPage;
     InitializeComponent();
     hs = HighScores.Load(System.IO.Path.Combine(Directory.GetCurrentDirectory(), "Saves/HighScoreSave.txt"));
 }