Example #1
0
        public void TurnEngine_Attack_Valid_Empty_Monster_List_Should_Fail()
        {
            // Arrange
            var PlayerInfo = new PlayerInfoModel(new CharacterModel());

            // Act
            var result = Engine.Attack(PlayerInfo);

            // Reset
            Engine.StartBattle(false);   // Clear the Engine

            // Assert
            Assert.AreEqual(true, result);
        }
Example #2
0
        public void TurnEngine_Attack_Valid_Empty_Monster_List_Should_Fail()
        {
            // Arrange
            Engine.CharacterList.Clear();
            Engine.CharacterList.Add(new CharacterModel());
            Engine.MonsterList.Clear();

            // Make the List
            Engine.EntityList = Engine.MakeEntityList();

            // Act
            var result = Engine.Attack(Engine.EntityList
                                       .Where(m => m.EntityType == EntityTypeEnum.Character).FirstOrDefault());

            // Reset
            Engine.StartBattle(false);   // Clear the Engine

            // Assert
            Assert.AreEqual(false, result); // should be false since no monster to attack
        }
        public void HakathonScenario_4_greedy_char_drinks_Health_Potions_Should_Pass()
        {
            /*
             * Scenario Number:
             *      #4
             *
             * Description:
             *      Every Round should have 6 new health potions added
             *      and if you are in auto battle and have a character bellow 20%
             *      they are really greedy and would drink all potions before an attack
             *
             * Changes Required (Classes, Methods etc.)  List Files, Methods, and Describe Changes:
             *      RoundEngine.cs
             *            added a populatePotionsFunction
             *            new round populates the potionspool
             *      TurnEngine.cs
             *            add a function called DrinkAllPotions will have a character drink all health potions even if they only need one
             *            added a fucntion called bellowTwentyHealth will return true is health bellow 20 percent
             *            edited Attack to have a character that is bellow 20 percent drink all the potions
             *      Base Engine.cs
             *            add a variable called potions pool
             *
             * Test Algrorithm:
             *      make a character bellow 20 percent health
             *      make round healing on
             *      make auto battle on
             *      have a new round made to populate potion pool
             *      call attack with greedy character
             *      check the count of health potions in the pool
             *      Assert that the count is 0
             *
             * Test Conditions:
             *      potion pool is full and there is a character with less than 20 percent health
             *
             *
             * Validation:
             *      Validate the potions pool only has mana potions. it is to show that
             *      your character is greedy and will drink all the potions before anyone attacks
             */

            //Arrange
            //turning healing on
            Engine.RoundHealing           = RoundHealingEnum.Healing_on;
            Engine.BattleScore.AutoBattle = true;
            PlayerInfoModel character = new PlayerInfoModel();

            character.PlayerType = PlayerTypeEnum.Character;
            character.MaxHealth  = 100;
            double Bellow = (double)(character.MaxHealth * .20);

            character.CurrHealth = (int)(Bellow - 1);
            Engine.CharacterList.Add(character);

            //Act
            //seeing if the potion list will be populated with 6th potions
            Engine.NewRound();

            Engine.Attack(character);

            bool potions_Health_0_count = false;
            int  count = 0;

            foreach (PotionsModel potion in Engine.potionPool)
            {
                if (potion.GetPotionType() == PotionsEnum.Health)
                {
                    count++;
                }
            }


            if (count == 0)
            {
                potions_Health_0_count = true;
            }

            //Assert
            Assert.AreEqual(true, potions_Health_0_count);
        }