public void Attack_DecreasesEnemyHpByAttackerDamage()
        {
            int warriorInitialHp = 100;
            var attacker         = new Warrior("Attacker", 50, 100);
            var warrior          = new Warrior("Warrrior", 30, warriorInitialHp);

            attacker.Attack(warrior);

            Assert.That(warrior.HP, Is.EqualTo(warriorInitialHp - attacker.Damage));
        }
예제 #2
0
        public void WarriorsCannotAtackOtherWarriorThatHasLessThan30Hp()
        {
            Warrior pesho = new Warrior("Pesho", 20, 50);
            Warrior gosho = new Warrior("Gosho", 15, 29);

            Assert.Throws <InvalidOperationException>(() =>
            {
                pesho.Attack(gosho);
            });
        }
        public void TestAttackWithLowHp()
        {
            Warrior attacker = new Warrior("Pesho", 10, 25);
            Warrior defender = new Warrior("Gosho", 5, 45);

            Assert.Throws <InvalidOperationException>(() =>
            {
                attacker.Attack(defender);
            });
        }
예제 #4
0
        public void AttackMethodShouldThrowInvalidOperationExceptionWhenDefenderHpIsLessOrEqual30(
            string defenderName, int defenderDamage, int defenderHp)
        {
            Warrior attacker = new Warrior("SunshineWarrion", 200, 500);

            Warrior defender = new Warrior(defenderName, defenderDamage, defenderHp);

            Assert.Throws <InvalidOperationException>(
                () => attacker.Attack(defender));
        }
예제 #5
0
        public void WarriorsCannotAtackStrongerWarriorThanThem()
        {
            Warrior pesho = new Warrior("Pesho", 20, 50);
            Warrior gosho = new Warrior("Gosho", 1000, 50);

            Assert.Throws <InvalidOperationException>(() =>
            {
                pesho.Attack(gosho);
            });
        }
        public void ShouldThrowInvalidOperationExceptionWhenTryToAttackEnenyWithLowThanMinHp(int defenderHp)
        {
            Warrior attacker = new Warrior("Vladi", 10, 100);
            Warrior defender = new Warrior("Oki", 10, defenderHp);

            Assert.Throws <InvalidOperationException>(() =>
            {
                attacker.Attack(defender);
            });
        }
        public void BothWarriorShouldTakeDamageWhenAttackEachOther()
        {
            Warrior attacker = new Warrior("Vladi", 10, 40);
            Warrior defender = new Warrior("Oki", 5, 50);

            attacker.Attack(defender);

            Assert.AreEqual(35, attacker.HP);
            Assert.AreEqual(40, defender.HP);
        }
예제 #8
0
        public void WarriorShouldThrowExceptionWhenVictimHPAreBelowOrEqual30AndTryAttack(string name, int damage, int hp)
        {
            Warrior warrior1 = new Warrior("Tosho", 50, 40);
            Warrior warrior2 = new Warrior(name, damage, hp);

            Assert.Throws <InvalidOperationException>(() =>
            {
                warrior1.Attack(warrior2);
            });
        }
예제 #9
0
        public void WarriorShouldThrowExceptionWhenVictimDamageAreBiggerThanHisHP(string name, int damage, int hp)
        {
            Warrior warrior1 = new Warrior("Tosho", 50, 40);
            Warrior warrior2 = new Warrior(name, damage, hp);

            Assert.Throws <InvalidOperationException>(() =>
            {
                warrior1.Attack(warrior2);
            });
        }
        public void MethodShouldThrowInvalidOperationExceptionWhenWarriorAttackEnemyWithHpBellow30()
        {
            var name   = "Pesho";
            var damage = 30;
            var hp     = 30;

            Warrior warrior = new Warrior(name, damage, hp);

            Assert.Throws <InvalidOperationException>(() => warrior.Attack(new Warrior("Gosho", 20, 20)));
        }
        public void MethodShouldTestTheReduceHpOfAttackedWarrior()
        {
            Warrior warrior = new Warrior("Pesho", 30, 40);
            Warrior enemy   = new Warrior("Gosho", 20, 40);

            warrior.Attack(enemy);

            var expectedHpEnemy = 10;
            var actualHpEnemy   = enemy.HP;

            Assert.AreEqual(expectedHpEnemy, actualHpEnemy);

            warrior.Attack(enemy);

            var expectedHpEnemyAfterSecondAttack = 0;
            var actualHpEnemyAfterSecondAttack   = enemy.HP;

            Assert.AreEqual(expectedHpEnemyAfterSecondAttack, actualHpEnemyAfterSecondAttack);
        }
예제 #12
0
        public void TestHpAfterAttack()
        {
            Warrior warriorA = new Warrior("Pesho", 20, 60);
            Warrior warriorB = new Warrior("Gosho", 40, 50);

            warriorA.Attack(warriorB);

            Assert.That(warriorA.HP, Is.EqualTo(20));
            Assert.That(warriorB.HP, Is.EqualTo(30));
        }
        public void Attack_Should_Throw_Exception_When_Hp_Lower_Then_31(int hp)
        {
            Warrior myWarrior = new Warrior("Stiv", 20, hp);
            Warrior enemy     = new Warrior("Peter", 20, 40);

            Assert.Throws <InvalidOperationException>(() =>
            {
                myWarrior.Attack(enemy);
            });
        }
        public void Attack_Should_Throw_Exception_Hp_Lower_Then_Enemys_Damage()
        {
            Warrior myWarrior = new Warrior("Stiv", 100, 90);
            Warrior enemy     = new Warrior("Peter", 100, 100);

            Assert.Throws <InvalidOperationException>(() =>
            {
                myWarrior.Attack(enemy);
            });
        }
예제 #15
0
        public void AttackShouldThrowExceptionWhenDHpBelowMinIs(int hp)
        {
            Warrior attacker = new Warrior("name", 10, 100);
            Warrior def      = new Warrior("some", 10, hp);

            Assert.Throws <InvalidOperationException>(() =>
            {
                attacker.Attack(def);
            }, "Enemy HP must be greater than 30 in order to attack him!");
        }
예제 #16
0
파일: Game.cs 프로젝트: booch94/conquest
        static void Main(string[] args)
        {
            Human   pesho   = new Human(100, "Pesho", "Peshov", 98);
            Warrior asparuh = new Warrior(100, "Han", "Asparagus", 1000);
            Weapon  axe     = new Weapon(10, 10, 100, 5, 50, 50, 51, 1);

            asparuh.SetTarget(pesho);
            asparuh.Attack(axe);
            Console.WriteLine(asparuh.Target.Health);
        }
        public void ShouldThrowInvalidOperationExceptionWhenHpIsTooLowAndTryToAttackOtherWarriors(int attackerHp)
        {
            Warrior attacker = new Warrior("Vladi", 10, attackerHp);
            Warrior defender = new Warrior("Oki", 10, 40);

            Assert.Throws <InvalidOperationException>(() =>
            {
                attacker.Attack(defender);
            });
        }
예제 #18
0
        public void AttackMethodShouldThrowExceptionIfWarriorTryAttackStrongerEnemies()
        {
            var warrior  = new Warrior("Svetlio", 100, 50);
            var opponent = new Warrior("Test", 100, 200);

            Assert.Throws <InvalidOperationException>(() =>
            {
                warrior.Attack(opponent);
            });
        }
        public void ShouldThrowInvalidOperationExceptionWhenTryToAttackTooStrongerEnemy()
        {
            Warrior attacker = new Warrior("Vladi", 10, 35);
            Warrior defender = new Warrior("Oki", 40, 35);

            Assert.Throws <InvalidOperationException>(() =>
            {
                attacker.Attack(defender);
            });
        }
예제 #20
0
        public void AttackMethodShouldThrowExceptionIfWarriorTryToAttackWarriorsWhichHPbBelow30(int belowHP)
        {
            var warrior  = new Warrior("Svetlio", 100, 200);
            var opponent = new Warrior("Test", 10, belowHP);

            Assert.Throws <InvalidOperationException>(() =>
            {
                warrior.Attack(opponent);
            });
        }
        public void WarriorShouldTakeDamageWhenAttackEnemyAndIfEnemyWarrirDieHisHpShouldBeZero()
        {
            Warrior attacker = new Warrior("Vladi", 80, 100);
            Warrior defender = new Warrior("Oki", 10, 60);

            attacker.Attack(defender);

            Assert.AreEqual(90, attacker.HP);
            Assert.AreEqual(0, defender.HP);
        }
예제 #22
0
        public void Warrior_Attacked_Decreas_HP()
        {
            Warrior warrior = new Warrior("Gosho", 50, 52);

            warrior.Attack(new Warrior("Pesho", 40, 40));

            int hp = warrior.HP;

            Assert.AreEqual(hp, 12);
        }
예제 #23
0
        public void AttackMethodShouldThrowInvalidOperationExceptionWhenAttackerHpIsLessThanDeffenderAttack()
        {
            int     attackerHp       = 100;
            int     deffenderAttack  = 101;
            Warrior attackWarrior    = new Warrior("FireWarrior", 100, attackerHp);
            Warrior deffenderWarrior = new Warrior("WaterWarrior", deffenderAttack, 200);

            Assert.Throws <InvalidOperationException>(
                () => attackWarrior.Attack(deffenderWarrior));
        }
        public void Throw_An_Exception_If_The_Health_Is_Less_Or_Equal_To_Zero_Than_The_Enemy_Damage()
        {
            // Arrange
            var warrior = new Warrior("Stavri", 100, 90);
            var enemy   = new Warrior("Ivan", 100, 100);

            // Assert
            Assert.Throws <InvalidOperationException>(
                () => warrior.Attack(enemy));
        }
예제 #25
0
        public void WarriorShouldNotBeAbleToAtackIfHpIsLessThan30()
        {
            Warrior pesho = new Warrior("Pesho", 20, 10);
            Warrior gosho = new Warrior("Gosho", 15, 50);

            Assert.Throws <InvalidOperationException>(() =>
            {
                pesho.Attack(gosho);
            });
        }
예제 #26
0
        public void Attack_DecreasesEnemyHpByAttackerDamage()
        {
            int     initialWarriorHp = 100;
            Warrior attacker         = new Warrior("Attacker", 50, 100);
            Warrior warrior          = new Warrior("Warrior", 50, initialWarriorHp);

            attacker.Attack(warrior);

            Assert.AreEqual(initialWarriorHp - attacker.Damage, warrior.HP);
        }
        public void TestAttackingStrongerEnemy()
        {
            Warrior attacker = new Warrior("Pesho", 10, 35);
            Warrior defender = new Warrior("Gosho", 40, 100);

            Assert.Throws <InvalidOperationException>(() =>
            {
                attacker.Attack(defender);
            });
        }
예제 #28
0
        public void AttackShouldThrowExceptionWhenAHpBelowMinIs(int hp)
        {
            Warrior attacker = new Warrior("some name", 50, hp);
            Warrior defender = new Warrior("def", 10, 40);

            Assert.Throws <InvalidOperationException>(() =>
            {
                attacker.Attack(defender);
            }, "Your HP is too low in order to attack other warriors!");
        }
        public void Attack_DecreaseHpWithAttack()
        {
            int initialHp = 100;
            var attacker  = new Warrior("Attacker", 50, initialHp);
            var warrior   = new Warrior("Warrrior", 30, 100);

            attacker.Attack(warrior);

            Assert.That(attacker.HP, Is.EqualTo(initialHp - warrior.Damage));
        }
예제 #30
0
        public void AttackMethodWorkCorrectly()
        {
            var attackWarrior = new Warrior("ivan", 5, 50);

            warrior.Attack(attackWarrior);
            int expectionAttackWarriorHp = 40;
            int expectionWarriorHp       = 95;

            Assert.AreEqual(expectionWarriorHp, warrior.HP);
            Assert.AreEqual(expectionAttackWarriorHp, attackWarrior.HP);
        }