public void HighScoresIgnoreNegativeScores()
        {
            TestableHighScores.SetInstance(new TestableHighScores());
            TestableHighScores.ClearHighScores();

            TestableHighScores.AddHighScore("Too Low", -12);

            Assert.IsEmpty(TestableHighScores.CurrentHighScores);
        }
        public void HighScoreNamesIgnorePercentSymbols()
        {
            TestableHighScores.SetInstance(new TestableHighScores());
            TestableHighScores.ClearHighScores();

            TestableHighScores.AddHighScore("Name%With%Percents", 100);

            Assert.AreEqual(
                new HighScores.HighScoreHolder("NameWithPercents", 100),
                TestableHighScores.CurrentHighScores.First()
                );
        }
        public void ClearHighScoresClearsAllEntries()
        {
            TestableHighScores.SetInstance(new TestableHighScores());
            TestableHighScores.ClearHighScores();

            TestableHighScores.AddHighScore("Matt", 166);
            TestableHighScores.AddHighScore("Caspian", 182);
            TestableHighScores.AddHighScore("Amira", 64);

            TestableHighScores.ClearHighScores();

            Assert.IsEmpty(TestableHighScores.CurrentHighScores);
        }
        public void HighScoresGetAddedInScoreOrder()
        {
            TestableHighScores.SetInstance(new TestableHighScores());
            TestableHighScores.ClearHighScores();

            HighScores.HighScoreHolder[] expectedOrder =
            {
                new HighScores.HighScoreHolder("Caspian", 182),
                new HighScores.HighScoreHolder("Matt",    166),
                new HighScores.HighScoreHolder("Amira",    64),
            };

            TestableHighScores.AddHighScore("Matt", 166);
            TestableHighScores.AddHighScore("Caspian", 182);
            TestableHighScores.AddHighScore("Amira", 64);

            Assert.That(TestableHighScores.CurrentHighScores, Is.EqualTo(expectedOrder));
        }
        public void HighScoresCountCannotExceedMaxHighScoresCount()
        {
            TestableHighScores.SetInstance(new TestableHighScores());
            TestableHighScores.ClearHighScores();

            HighScores.HighScoreHolder[] expectedOrder =
            {
                new HighScores.HighScoreHolder("Caspian", 182),
                new HighScores.HighScoreHolder("Matt",    166),
                new HighScores.HighScoreHolder("Zoey",    101),
                new HighScores.HighScoreHolder("Amira",    64),
                new HighScores.HighScoreHolder("R10", 22)
            };

            TestableHighScores.AddHighScore("Matt", 166);
            TestableHighScores.AddHighScore("R10", 22);
            TestableHighScores.AddHighScore("Too Low", 6);
            TestableHighScores.AddHighScore("Zoey", 101);
            TestableHighScores.AddHighScore("Caspian", 182);
            TestableHighScores.AddHighScore("Not Good Enough", 13);
            TestableHighScores.AddHighScore("Amira", 64);

            Assert.That(TestableHighScores.CurrentHighScores, Is.EqualTo(expectedOrder));
        }
        public void ChangingMaxHighScoresCountRemovesExceededEntries()
        {
            TestableHighScores.SetInstance(new TestableHighScores());
            TestableHighScores.ClearHighScores();

            HighScores.HighScoreHolder[] expectedOrder =
            {
                new HighScores.HighScoreHolder("Caspian", 182),
                new HighScores.HighScoreHolder("Matt",    166),
                new HighScores.HighScoreHolder("Zoey", 101)
            };

            TestableHighScores.AddHighScore("Matt", 166);
            TestableHighScores.AddHighScore("R10", 22);
            TestableHighScores.AddHighScore("Zoey", 101);
            TestableHighScores.AddHighScore("Caspian", 182);
            TestableHighScores.AddHighScore("Amira", 64);

            TestableHighScores.MaxHighScoresCount = 3;

            Assert.That(TestableHighScores.CurrentHighScores, Is.EqualTo(expectedOrder));

            TestableHighScores.MaxHighScoresCount = TestableHighScores.DefaultMaxHighScores;
        }