コード例 #1
0
        public void IfNoOccupationsMatchJustPickUnemployed()
        {
            var bob            = CharacterTestTemplates.AverageBob().OfRace("Human");
            var historyCreator = new FamilyHistoryCreator();

            historyCreator.ExecuteStep(bob);

            Assert.Equal(Occupation.Unemployed(), bob.Get <History>().FamilyTree.Father.Get <Occupation>());
            Assert.Equal(Occupation.Unemployed(), bob.Get <History>().FamilyTree.Mother.Get <Occupation>());
        }
コード例 #2
0
        public void CanCreateFamilyTreeWithParents()
        {
            var generator = new FamilyHistoryCreator();
            var character = CharacterTestTemplates.AverageBob().OfRace("Human");

            generator.ExecuteStep(character);

            var familyTree = character.Get <History>().FamilyTree;

            Assert.NotNull(familyTree.FatherName);
            Assert.NotNull(familyTree.MotherName);
            Assert.NotEmpty(familyTree.FatherName);
            Assert.NotEmpty(familyTree.MotherName);
        }
コード例 #3
0
        public void AddSomeWeightingToSkillsTableForParentOccupation()
        {
            var bob = CharacterTestTemplates.AverageBob().OfRace("Human");

            bob.History.BirthCircumstance.ParentProfessions = new string[] { "lower-class" };

            var peasant = new Occupation("peasant", "commoner", new string[] { "lower-class" });

            peasant.Skills = new string[] { "Perception" };
            var occGateway = EntityGateway <Occupation> .LoadWithSingleItem(peasant);

            var historyCreator = new FamilyHistoryCreator(occGateway);

            historyCreator.ExecuteStep(bob);

            Assert.True(bob.Strategy.FavoredSkills.HasOption("Perception"));
        }
コード例 #4
0
        public void MotherAndFatherAreGivenJobsDependingOnTagsFromBirthCircumstance()
        {
            //Bob's parents were lower-class
            var bob = CharacterTestTemplates.AverageBob().OfRace("Human");

            bob.History.BirthCircumstance.ParentProfessions = new string[] { "lower-class" };

            var peasant    = new Occupation("peasant", "commoner", new string[] { "lower-class" });
            var occGateway = EntityGateway <Occupation> .LoadWithSingleItem(peasant);

            var historyCreator = new FamilyHistoryCreator(occGateway);

            historyCreator.ExecuteStep(bob);

            Assert.Equal(peasant, bob.Get <History>().FamilyTree.Father.Get <Occupation>());
            Assert.Equal(peasant, bob.Get <History>().FamilyTree.Mother.Get <Occupation>());
        }
コード例 #5
0
        public void AtLeastOneParentHasTheSameLastNameAsTheCharacter()
        {
            var race = new Race();

            race.Name = "Human";
            var character = CharacterTestTemplates.AverageBob();

            character.Add(race);
            character.FirstName = "Foo";
            character.LastName  = "BarOrSomethingCrazyThatWontHappenAccidentally";
            var history = character.Get <History>();

            var gen = new FamilyHistoryCreator();

            gen.ExecuteStep(character);
            var names = history.FamilyTree.FatherName + " " + history.FamilyTree.MotherName;

            Assert.Contains("BarOrSomethingCrazyThatWontHappenAccidentally", names);
        }