public void BrokenAxeShouldNotAttack()
        {
            //Arrange
            string exceptionMessage = string.Empty;

            //Act
            try
            {
                while (axe.DurabilityPoints != 0)
                {
                    axe.Attack(dummy);

                    if (dummy.IsDead())
                    {
                        dummy = new Dummy(DummyHealth, DummyExperience);
                    }
                }

                axe.Attack(dummy);
            }
            catch (InvalidOperationException ioe)
            {
                exceptionMessage = ioe.Message;
            }

            //Assert
            Assert.AreEqual("Axe is broken.", exceptionMessage, "Axe attacks although broken.");
        }
Exemple #2
0
        public void DeadDummy_ThrowsExeption_IfAttacked()
        {
            Dummy dummy = new Dummy(0, 10);

            //dummy.TakeAttack(5);
            Assert.AreEqual(true, dummy.IsDead());

            //Assert.That(dummy.IsDead(), Is.Equals(true),"Dead dummy can't be attack!");
        }
Exemple #3
0
        public void TestWhenDummyIsDead()
        {
            //public bool IsDead()
            //{
            //    return this.health <= 0;
            //}
            var dummy = new Dummy(-10, 10);

            Assert.IsTrue(dummy.IsDead());
        }
Exemple #4
0
        public void AliveDummy_ThrowsExeption_IfGiveXP()
        {
            Dummy dummy = new Dummy(0, 20);

            dummy.GiveExperience();

            Assert.AreEqual(true, dummy.IsDead());

            //Assert.That(dummy.IsDead(), Throws.ArgumentException
            //.With.Message.EqualTo("Alive dummy can't give XP!"));
        }
        public void DeadDummyThrowsExceptionIfAttacked()
        {
            Dummy dummy        = new Dummy(DummyHealth, DummyExperience);
            int   attackPoints = 6;

            while (!dummy.IsDead())
            {
                dummy.TakeAttack(attackPoints);
            }
            Assert.Throws <InvalidOperationException>(() => dummy.TakeAttack(attackPoints));
        }
        public void DeadDummyCanGiveExperience()
        {
            Dummy dummy        = new Dummy(DummyHealth, DummyExperience);
            int   AttackPoints = 10;

            while (!dummy.IsDead())
            {
                dummy.TakeAttack(AttackPoints);
            }

            var gotExperience = dummy.GiveExperience();

            Assert.AreEqual(gotExperience, DummyExperience);
        }
Exemple #7
0
        public void DeadDummyThrowsExceptionIfAttacked()
        {
            Axe   axe   = new Axe(10, 10);
            Dummy dummy = new Dummy(10, 10);

            dummy.IsDead();

            dummy.TakeAttack(1);

            Assert.That(() =>
            {
                dummy.TakeAttack(1);
            },
                        Throws.InvalidOperationException.With.Message.EqualTo("Target is not dead."));
        }
        public void TestReturnExp1()
        {
            var test = new Dummy(0, 10);

            Assert.IsTrue(test.IsDead());
        }
 public void AttackingWithDefaultAttackShouldKillDummy()
 {
     axe.Attack(dummy);
     Assert.That(dummy.IsDead() == true, "Dummy with 10 hitpoints should be dead after being attacked for 10");
 }
Exemple #10
0
        public void TestIfDummyIsAlive()
        {
            var dummy = new Dummy(10, 10);

            Assert.IsTrue(!dummy.IsDead());
        }