コード例 #1
0
        public void RemoveHealthFromOpponentHp_WhenApplied()
        {
            //Arrange
            var casterMock   = new Mock <IHero>();
            var opponentMock = new Mock <IHero>();
            var dmgAbility   =
                new DamagingAbility("Blade Storm", 1, HeroClass.Warrior, EffectType.Damage, 18);

            casterMock.Setup(x => x.DmgStartOfRange).Returns(10);
            casterMock.Setup(x => x.DmgEndOfRange).Returns(20);

            opponentMock.Setup(x => x.HealthPoints).Returns(100);
            opponentMock.Setup(x => x.HasRessistance).Returns(false);

            var opponent = new Warrior("Hero", HeroClass.Warrior, 200, 10, 15);

            casterMock.Setup(x => x.Opponent).Returns(opponent);

            dmgAbility.Caster = casterMock.Object;

            //Act
            dmgAbility.Apply();
            //Assert
            Assert.AreNotEqual(100, opponent.HealthPoints);
        }
コード例 #2
0
        public void ReturnTheProperValue_WhenGetMethodIsCalled()
        {
            // Arrange
            var ability = new DamagingAbility("Pesho", 2, HeroClass.Assasin, EffectType.Damage, 2);

            // Act
            var result = ability.Name;

            // Assert
            Assert.AreEqual("Pesho", result);
        }
コード例 #3
0
        public void CreateSpellBook(IHero hero)
        {
            var spellPool   = PopulateSpellPool().Where(x => x.HeroClass == hero.HeroClass);
            var basicAttack = new DamagingAbility("Basic Attack", 0, hero.HeroClass, EffectType.Damage, 0);

            hero.Abilities.Add(basicAttack); //add basic attack

            var dmgAbilities = spellPool.Where(x => x.Type == EffectType.Damage).ToList();

            hero.Abilities.Add(dmgAbilities[RandomProvider.Generate(0, dmgAbilities.Count - 1)]);  //add 2nd spell                                                                                                      //?

            var effectAbilitues = spellPool.Where(x => x.Type != EffectType.Damage).ToList();

            hero.Abilities.Add(effectAbilitues[RandomProvider.Generate(0, effectAbilitues.Count - 1)]);   //add 3rd spell

            foreach (var ability in hero.Abilities)
            {
                ability.Caster = hero;
            }
        }
コード例 #4
0
    public override IAbilityComponent Duplicate()
    {
        DamagingAbility copy = new DamagingAbility(Data, ParentAbility);

        return(copy);
    }
コード例 #5
0
 public void ThrowsArgumentException_WhenInvalidValueIsPassed()
 {
     // Arrange
     var ability = new DamagingAbility("", 2, HeroClass.Assasin, EffectType.Damage, 2);
 }