Пример #1
0
        public void PickLanguagesThatAreKnownToTheRace()
        {
            var strategy = new CharacterStrategy();

            strategy.AddLanguageKnown("Elvish");
            strategy.AddLanguageKnown("Giant");
            var character = new CharacterSheet(strategy);
            var subject   = new LanguageSelector(languageGateway);

            subject.ExecuteStep(character);
            Assert.NotStrictEqual(character.Languages.Select(x => x.Name), new string[] { "Elvish", "Giant" });
        }
Пример #2
0
        public void DoNotRepeatedlyAddKnownLanguages()
        {
            var strategy = new CharacterStrategy();

            strategy.AddLanguageKnown("Corgi");
            strategy.AddLanguageKnown("Corgi");
            strategy.AddLanguageKnown("Elvish");
            var subject   = new LanguageSelector(languageGateway);
            var character = new CharacterSheet(strategy);

            subject.ExecuteStep(character);
            Assert.NotStrictEqual(character.GetAll <Language>().Select(x => x.Name), new string[] { "Corgi", "Elvish" });
        }
Пример #3
0
        public void IfAvailableLanguagesIsSetToALLThenAnythingIsPossible()
        {
            var strategy = new CharacterStrategy();

            strategy.AddLanguageChoice("ALL");
            var subject = new LanguageSelector(languageGateway);

            //Pick two bonus Language -> This should always return all the above
            for (int i = 0; i < 1000; i++)
            {
                var character = new CharacterSheet(strategy);
                character.AbilityScores.SetScore(AbilityScoreTypes.Intelligence, 24);
                subject.ExecuteStep(character);
                var res = character.GetAll <Language>().Select(x => x.Name);
                Assert.NotStrictEqual(res, new string[] { "Elvish", "Giant", "Corgi", "Boo" });
            }
        }
Пример #4
0
        public void PickExtraLanguagesIfSmartEnough()
        {
            var strategy = new CharacterStrategy();

            strategy.AddLanguageKnown("Elvish");
            strategy.AddLanguageChoice("Corgi");
            strategy.AddLanguageChoice("Giant");
            var subject = new LanguageSelector(languageGateway);

            //Pick two bonus Language -> This should always return all the above
            for (int i = 0; i < 1000; i++)
            {
                var character = new CharacterSheet(strategy);
                character.AbilityScores.SetScore(AbilityScoreTypes.Intelligence, 14);
                subject.ExecuteStep(character);
                var res = character.GetAll <Language>().Select(x => x.Name);

                AssertExtensions.EquivalentLists(new string[] { "Elvish", "Giant", "Corgi" }, res);
            }
        }