Esempio n. 1
0
        public void PickLanguagesThatAreKnownToTheRace()
        {
            var race = new Race();

            race.KnownLanguages.Add("Elvish");
            race.KnownLanguages.Add("Giant");
            var subject = new LanguageSelector(new LanguageTestRepo());
            var res     = subject.PickLanguages(race, 0);

            Assert.AreEqual(2, res.Count());
            Assert.IsTrue(res.Any(x => x.Name == "Elvish"));
            Assert.IsTrue(res.Any(x => x.Name == "Giant"));
        }
Esempio n. 2
0
        public void IfRunOutOfLanguagesItsOk()
        {
            var race = new Race();

            race.KnownLanguages.Add("Elvish");
            race.AvailableLanguages.Add("Corgi");
            race.AvailableLanguages.Add("Giant");
            var subject = new LanguageSelector(new LanguageTestRepo());

            //Pick two bonus Language -> This should always return all the above
            for (int i = 0; i < 1000; i++)
            {
                var res = subject.PickLanguages(race, 6);
                Assert.AreEqual(3, res.Count());
                Assert.IsTrue(res.Any(x => x.Name == "Elvish"));
                Assert.IsTrue(res.Any(x => x.Name == "Giant"));
                Assert.IsTrue(res.Any(x => x.Name == "Corgi"));
            }
        }