Exemplo n.º 1
0
        public void SettingRaceLoadsTraits()
        {
            var sheet   = new CharacterSheet(_testSkills);
            var gateway = new TestTraitGateway();

            //Set up the trait
            var trait = new Trait();

            trait.Name = "Elfy";
            gateway.Traits.Add(trait);

            //Set up the race
            var elf = new Race();

            elf.Traits.Add("Elfy");
            elf.SizeSetting = CharacterSize.Medium;
            elf.HeightRange = DiceStrings.ParseDice("10d6");
            elf.WeightRange = DiceStrings.ParseDice("20d8");

            //sheet.SetRace (elf);
            var assign = new RaceSelector(new TestRacesGateway(), gateway);

            assign.SetRace(sheet, elf);
            Assert.AreEqual(elf, sheet.Race);
            Assert.IsTrue(sheet.Traits.Any(x => x == trait));
        }
Exemplo n.º 2
0
        public void SettingRaceCalculatesSize()
        {
            var gateway = new TestTraitGateway();

            var sheet = new CharacterSheet(_testSkills);

            var smallGuy = new Race();

            smallGuy.SizeSetting = CharacterSize.Small;
            smallGuy.HeightRange = DiceStrings.ParseDice("2d4+10");
            smallGuy.WeightRange = DiceStrings.ParseDice("2d4+100");


            var assign = new RaceSelector(new TestRacesGateway(), gateway);

            assign.SetRace(sheet, smallGuy);
            Assert.AreEqual(CharacterSize.Small, sheet.Size.Size);
            Assert.GreaterOrEqual(sheet.Size.Height, 12);
            Assert.GreaterOrEqual(sheet.Size.Weight, 102);
        }