Esempio n. 1
0
        public void ShouldShouldReturnProficienciesForDwarfWizard()
        {
            //assign
            _characterSheet = new CharacterSheet(new Wizard(), new HillDwarf(), _attributeSet);
            List <IProficiency> expectedProficiencies = new List <IProficiency>
            {
                new Battleaxe(),
                new Handaxe(),
                new ThrowingHammer(),
                new Warhammer(),
                new BrewersSupplies(),
                new MasonsTools(),
                new SmithsTools(),
                new Dagger(),
                new Darts(),
                new Sling(),
                new Quarterstaff(),
                new LightCrossbow()
            };

            //act
            List <IProficiency> actualProficiencies = _characterSheet.Proficiencies();

            //assert
            actualProficiencies.All(i => expectedProficiencies.Contains(i)).Should().BeTrue();
        }
Esempio n. 2
0
        public void ShouldReturnJsonObject()
        {
            //arrange
            string raceJson         = "\"race\":\"Human\"";
            string classJson        = "\"class\":\"Wizard\"";
            string attributeSetJson = "\"characterAttributes\":[" +
                                      "{\"characterAttribute\":\"STR\",\"value\":0}," +
                                      "{\"characterAttribute\":\"CON\",\"value\":0}," +
                                      "{\"characterAttribute\":\"INT\",\"value\":0}," +
                                      "{\"characterAttribute\":\"WIS\",\"value\":0}," +
                                      "{\"characterAttribute\":\"CHR\",\"value\":0}," +
                                      "{\"characterAttribute\":\"DEX\",\"value\":10}," +
                                      "]";

            IAttributeSet attributeSet = new EmptyAttributeSet();

            _characterSheet = new CharacterSheet(new Wizard(), new Human(), attributeSet);
            string proficienciesJson = $"\"Proficiencies\":[{string.Join(",", _characterSheet.Proficiencies().Select(x => $"\"{x}\""))}],";
            string expectedJson      = $"{{characterSheet:{{{raceJson},{classJson},{ attributeSetJson},{proficienciesJson}}}}}";

            attributeSet.SetAttribute(CharacterAttributeName.Dexterity, new AttributeScore(10));

            StringBuilder sb = new StringBuilder();

            //act
            _characterSheet.AddJsonToStringbuilder(sb);
            //assert
            sb.ToString().Should().Be(expectedJson);
        }
Esempio n. 3
0
        public void ShouldShouldReturnProficienciesForDwarfFighter()
        {
            //assign
            _characterSheet = new CharacterSheet(new Fighter(), new HillDwarf(), _attributeSet);
            List <IProficiency> expectedProficiencies = new List <IProficiency>
            {
                new Battleaxe(),
                new Handaxe(),
                new ThrowingHammer(),
                new Warhammer(),
                new BrewersSupplies(),
                new MasonsTools(),
                new SmithsTools(),
                new SimpleWeapons(),
                new MartialWeapons(),
                new AllArmor(),
                new AllShields()
            };

            //act
            List <IProficiency> actualProficiencies = _characterSheet.Proficiencies();

            //assert
            actualProficiencies.All(i => expectedProficiencies.Contains(i)).Should().BeTrue();
        }