Exemplo n.º 1
0
        public virtual void Setup()
        {
            Character MagicGladiador = new Gladiador("MagicGladiador");
            Character KingTroll      = new Troll("KingTroll");
            Character QueenElf       = new Elf("QueenElf");
            Character MagicWizard    = new Wizard("MagicWizard");
            IItem     PinkyBow       = new BowAndArrow();
            IItem     IcedCup        = new Ice();

            QueenElf.AddItem(IcedCup);
            QueenElf.AddItem(PinkyBow);
            IItem Blade = new LightSaber();
            IItem Axe   = new FireAx();

            KingTroll.AddItem(Blade);
            KingTroll.AddItem(Axe);
            IItem Saber    = new LightSaber();
            IItem BlueRobe = new Robes();

            MagicWizard.AddItem(Saber);
            MagicWizard.AddItem(Blade);
            IItem            ChainArmor = new CompleteArmor();
            InfiniteGauntlet Gauntlet   = new InfiniteGauntlet();

            Gauntlet.AddStone();
            MagicGladiador.AddItem(ChainArmor);
            MagicGladiador.AddItem(Gauntlet);
            characters.Add(MagicGladiador);
            characters.Add(KingTroll);
            characters.Add(QueenElf);
            characters.Add(MagicWizard);
        }
Exemplo n.º 2
0
        public void GetElfStats()
        {
            testingElf3.AddItem(testingItem);
            testingElf3.AddItem(testingItem2);
            testingElf3.RemoveItem(testingItem);
            int expectedElfAttack  = 30;
            int expectedElfDefense = 25;

            Assert.AreEqual(expectedElfAttack, testingElf3.GetCharacterAttack());
            Assert.AreEqual(expectedElfDefense, testingElf3.GetCharacterDefense());
        }
Exemplo n.º 3
0
        public void WhenAdding2ItemsToACharacterTheCharactersDamageIsTheSumOfBothItems()
        {
            Elf        elfo          = new Elf("Eduardo");
            MagicStick palitoMagico  = new MagicStick();
            MagicStick palitoMagico2 = new MagicStick();

            elfo.AddItem(palitoMagico);
            elfo.AddItem(palitoMagico2);
            int expectedAttackPower = palitoMagico.AttackPower + palitoMagico2.AttackPower;

            Assert.AreEqual(elfo.AttackPower, expectedAttackPower);
        }
Exemplo n.º 4
0
        public void TestAttackPower2Items11()
        {
            Elf   elf   = new Elf("Elf");
            Stick stick = new Stick();
            Magic magic = new Magic();

            elf.AddItem(stick);
            elf.AddItem(magic);

            int expected = stick.AttackPower + magic.AttackPower;

            Assert.AreEqual(expected, elf.AttackPower);
        }
Exemplo n.º 5
0
        public void TestPoderDefensa()
        {
            elf = new Elf("El elfo");
            Magic magic = new Magic();

            elf.AddItem(magic);

            int expectedDefensePower = 0;

            foreach (IItem item in elf.Items)
            {
                if (item is IDefenseItem)
                {
                    if (item is Robes)
                    {
                        expectedDefensePower = expectedDefensePower + ((Robes)item).DefensePower;
                    }
                    if (item is Magic)
                    {
                        expectedDefensePower = expectedDefensePower + ((Magic)item).DefensePower;
                    }
                    if (item is MagicStick)
                    {
                        expectedDefensePower = expectedDefensePower + ((MagicStick)item).DefensePower;
                    }
                    if (item is Armor)
                    {
                        expectedDefensePower = expectedDefensePower + ((Armor)item).DefensePower;
                    }
                }
            }
            Assert.AreEqual(expectedDefensePower, elf.DefensePower);
        }
Exemplo n.º 6
0
        public void AddItem()
        {
            testingElf.AddItem(testingItem);
            string expectedItemName = "testingItem";

            Assert.AreEqual(expectedItemName, testingElf.ItemsList[0].Name);
        }
Exemplo n.º 7
0
        public void Cannot_add_magic_item_to_non_wizard_character()
        {
            SpellBook spellBook = new SpellBook(new List <Spell>());
            Elf       elf       = new Elf(1, 1, 1);


            Assert.Catch <CannotAddItemException>(() => elf.AddItem(spellBook));
        }
Exemplo n.º 8
0
        public void TestCharacterDefense()
        {
            Elf character = new Elf("sofia");

            character.AddItem(new Magic());
            int expected = 32;

            Assert.AreEqual(32, character.DefensePower);
        }
Exemplo n.º 9
0
        public void AddItemShouldModifyElfStats()
        {
            int expectedElfAttack  = 30;
            int expectedElfDefense = 25;

            testingElf2.AddItem(testingItem2);

            Assert.AreEqual(expectedElfAttack, testingElf2.GetCharacterAttack());
            Assert.AreEqual(expectedElfDefense, testingElf2.GetCharacterDefense());
        }
Exemplo n.º 10
0
        public void WhenAddingMagicToACharacterItsDefenseGoesUp()
        {
            Elf   elfo  = new Elf("Eduardo");
            Magic magia = new Magic();

            elfo.AddItem(magia);
            int expectedDefense = 32;

            Assert.AreEqual(elfo.DefensePower, expectedDefense);
        }
Exemplo n.º 11
0
        public void WhenAddingMagicToACharacterItsAttackPowerGoesUp()
        {
            Elf   elfo  = new Elf("Eduardo");
            Magic magia = new Magic();

            elfo.AddItem(magia);
            int expectedAttackPower = 80;

            Assert.AreEqual(elfo.AttackPower, expectedAttackPower);
        }
        public void TestCharacterPower()
        {
            string nombre = "elfo";
            Elf    elf    = new Elf(nombre);
            Magic  magic  = new Magic();

            elf.AddItem(magic);
            int expected = (magic.AttackPower);

            Assert.AreEqual(expected, elf.AttackPower);
        }
Exemplo n.º 13
0
        //Al crear un personaje y asignarle un item Magic su poder de ataque aumenta de forma acorde.
        public void SumarPoder()
        {
            Elf   elfo     = new Elf("Elfo");
            Magic magia    = new Magic();
            int   original = elfo.AttackPower;

            elfo.AddItem(magia);
            int Expected = magia.AttackPower + original;

            Assert.AreEqual(Expected, elfo.AttackPower);
        }
Exemplo n.º 14
0
        public void CharacterMagicDefense()
        {
            Elf   elf1   = new Elf("Elf1");
            Magic magic1 = new Magic();

            elf1.AddItem(magic1);
            int actual   = elf1.DefensePower;
            int expected = 32;

            Assert.AreEqual(actual, expected);
        }
Exemplo n.º 15
0
        public void CharacterMagicAttack()
        {
            Elf   elf1   = new Elf("Elf1");
            Magic magic1 = new Magic();

            elf1.AddItem(magic1);
            int actual   = elf1.AttackPower;
            int expected = 80;

            Assert.AreEqual(actual, expected);
        }
        public void TestCharacterDefense()
        {
            string nombre = "elfo";
            Elf    elf    = new Elf(nombre);
            Magic  magic  = new Magic();
            Robes  robes  = new Robes();

            elf.AddItem(magic);
            int expected = (magic.DefensePower + robes.DefensePower);

            Assert.AreEqual(expected, elf.DefensePower);
        }
Exemplo n.º 17
0
        public void RemoveMagicItem()
        {
            Elf   Elfo  = new Elf("Elfito");
            Magic Magia = new Magic();

            Elfo.AddItem(Magia);
            int DefensaConMagia = Elfo.DefensePower;

            Elfo.RemoveItem(Magia);
            int DefensaSinMagia = Elfo.DefensePower;

            Assert.AreEqual(DefensaConMagia - Magia.DefensePower, DefensaSinMagia);
        }
Exemplo n.º 18
0
        static void Main(string[] args)
        {
            // IScenario scenario = new ConsoleScenario();
            // scenario.Setup();
            // scenario.Run();
            Elf elfo = new Elf("El Elfo");
            Wizard wizard = new Wizard("El Mago");
            Troll troll = new Troll("El Troll");

            Coraza coraza = new Coraza();
            Cuchillo cuchillo = new Cuchillo();
            Magic magic = new Magic();
            Martillo martillo = new Martillo();
            Palo palo = new Palo();
            Rifle rifle = new Rifle();
            RifleConCuchillo rifleConCuchillo = new RifleConCuchillo();
            Robes robes = new Robes();

            List<IGema> Gemas = new List<IGema>();
            Gemas.Add(new GemaAmarilla());
            Gemas.Add(new GemaCeleste());
            Gemas.Add(new GemaRoja());

            GuanteDePoder guanteDePoder  = new GuanteDePoder(Gemas);         

            elfo.AddItem(magic);
            elfo.AddItem(robes);
            wizard.AddItem(guanteDePoder);
            troll.AddItem(rifleConCuchillo);

            AttackEncounter attackEncounter = new AttackEncounter(elfo,wizard);
            ConsoleReporter consoleReporter = new ConsoleReporter();
            attackEncounter.Reporter = consoleReporter;
            attackEncounter.DoEncounter();
            AttackEncounter attackEncounter1 = new AttackEncounter(wizard, troll);
            attackEncounter1.Reporter = consoleReporter;
            attackEncounter1.DoEncounter();

        }
        public void TestCharacterSacarMagicDef()
        {
            string nombre = "elfo";
            Elf    elf    = new Elf(nombre);
            Magic  magic  = new Magic();
            Robes  robes  = new Robes();

            elf.AddItem(magic);
            elf.RemoveItem(magic);
            int expected = (robes.DefensePower);

            Assert.AreEqual(expected, elf.AttackPower);
        }
Exemplo n.º 20
0
        public void WhenThereIsAnExchangeEncounterTheSenderLosesAllItems()
        {
            Elf        elfo          = new Elf("Eduardo");
            MagicStick palitoMagico  = new MagicStick();
            MagicStick palitoMagico2 = new MagicStick();
            Robes      robe          = new Robes();

            elfo.AddItem(palitoMagico);
            elfo.AddItem(palitoMagico2);
            Elf          elfoChorro = new Elf("El roba eduardos");
            List <IItem> items      = new List <IItem>();

            items.Add(palitoMagico);
            items.Add(palitoMagico2);
            items.Add(robe);
            ExchangeEncounter encuentro = new ExchangeEncounter(elfo, elfoChorro, items);

            encuentro.DoEncounter();
            List <IItem> expectedItems = new List <IItem>();

            Assert.AreEqual(expectedItems, elfo.Items);
        }
Exemplo n.º 21
0
        public void RecieveAttackShouldDamageIfEnemyDefenseIsNotGreater()
        {
            Elf attacker1 = new Elf(100, "attacker1");
            Elf attacker2 = new Elf(100, "attacker2");

            attacker1.AddItem(testingItem2);
            attacker2.AddItem(testingItem);

            attacker2.RecieveAttack(attacker1.GetCharacterAttack());

            int expected = 80;

            Assert.AreEqual(expected, attacker2.Health);
        }
        public void ExcecuteTestForMoreThanOneItem()
        {
            Elf         character       = new Elf("TestCharacter", 50, 10, 40);
            Wizard      Secondcharacter = new Wizard("TestCharacter", 50, 10, 40);
            GenericItem item            = new GenericItem("TestItem", 10, 10, 0, false);
            GenericItem Seconditem      = new GenericItem("SeCONDTestItem", 10, 10, 0, false);

            character.AddItem(item);
            character.AddItem(Seconditem);
            List <Item> listOfItem = new List <Item>();

            listOfItem.Add(item);
            listOfItem.Add(Seconditem);
            List <Character> listOfCharacter = new List <Character>();

            listOfCharacter.Add(character);
            listOfCharacter.Add(Secondcharacter);
            ExchangeEncounter exchangeEncounter = new ExchangeEncounter(listOfCharacter, listOfItem);

            exchangeEncounter.Excecute();
            Assert.AreEqual(character.GetItems().Count, 0);
            Assert.AreEqual(Secondcharacter.GetItems()[0], item);
            Assert.AreEqual(Secondcharacter.GetItems()[1], Seconditem);
        }
Exemplo n.º 23
0
        public void TestCharacterWithMagicAttackPower7()
        {
            Elf elf = new Elf("Elf");

            int firstExpected = 0;

            Assert.AreEqual(firstExpected, elf.AttackPower);

            Magic magic = new Magic();

            elf.AddItem(magic);

            int secondExpected = 80;

            Assert.AreEqual(secondExpected, elf.AttackPower);
        }
Exemplo n.º 24
0
        public void EnoughAttackShouldKill()
        {
            Elf  attacker1      = new Elf(100, "attacker1");
            Elf  attacker2      = new Elf(100, "attacker2");
            Item theAdminsSword = new Item("The admin sword", 1000, 1000);

            attacker1.AddItem(theAdminsSword);
            attacker2.AddItem(testingItem);

            attacker2.RecieveAttack(attacker1.GetCharacterAttack());

            int expected = 0;

            Assert.AreEqual(expected, attacker2.Health);
            Assert.True(attacker2.IsDead);
        }
Exemplo n.º 25
0
        public void WhenHPIs0CharacterIsDead()
        {
            Elf      elfo       = new Elf("Eduardo");
            Elf      elfoBufado = new Elf("El Mata Eduardos");
            Gauntlet gauntlet   = new Gauntlet();

            for (int i = 0; i < 10; i++)
            {
                gauntlet.AddGem(new Gem());
            }
            elfoBufado.AddItem(gauntlet);
            elfo.ReceiveAttack(elfoBufado.AttackPower);
            bool expectedIsDead = true;

            Assert.AreEqual(elfo.IsDead, expectedIsDead);
        }