static void Main(string[] args)
        {
            var mage =
                new Hero.Builder(Profession.MAGE, "Riobard")
                .withHairColor(HairColor.BLACK)
                .withWeapon(Weapon.DAGGER)
                .build();

            Console.WriteLine(mage.ToString());

            var warrior =
                new Hero.Builder(Profession.WARRIOR, "Amberjill")
                .withHairColor(HairColor.BLOND)
                .withHairType(HairType.LONG_CURLY)
                .withArmor(Armor.CHAIN_MAIL)
                .withWeapon(Weapon.SWORD)
                .build();

            Console.WriteLine(warrior.ToString());

            var thief =
                new Hero.Builder(Profession.THIEF, "Desmond")
                .withHairType(HairType.BALD)
                .withWeapon(Weapon.BOW)
                .build();

            Console.WriteLine(thief.ToString());
        }
Example #2
0
        public void testBuildHero()
        {
            string heroName = "Sir Lancelot";

            var hero = new Hero.Builder(Profession.WARRIOR, heroName)
                       .withArmor(Armor.CHAIN_MAIL)
                       .withWeapon(Weapon.SWORD)
                       .withHairType(HairType.LONG_CURLY)
                       .withHairColor(HairColor.BLOND)
                       .build();

            Assert.NotNull(hero);
            Assert.NotNull(hero.ToString());
            Assert.Equal(Profession.WARRIOR, hero.profession);
            Assert.Equal(heroName, hero.name);
            Assert.Equal(Armor.CHAIN_MAIL, hero.armor);
            Assert.Equal(Weapon.SWORD, hero.weapon);
            Assert.Equal(HairType.LONG_CURLY, hero.hairType);
            Assert.Equal(HairColor.BLOND, hero.hairColor);
        }