예제 #1
0
    public void WeaponLosesDurabilityAfterEachAttack()
    {
        axe.Attack(dummy);

        Assert.That(axe.DurabilityPoints, Is.EqualTo(axeExpectedDurabilityPoints),
                    "Axe Durability does not change after attack !");
    }
        public void DummyLosesHealthIfAttacked()
        {
            axe.Attack(dummy);
            int expectdHealth = 10;

            Assert.AreEqual(dummy.Health, expectdHealth, "Dummy does not lose health after attack!");
        }
예제 #3
0
        public void AxeLosesDurabilyAfterAttack()
        {
            axe.Attack(dummy);

            Assert.AreEqual(1, axe.DurabilityPoints,
                            "Axe Durability doesn't change after attack");
        }
예제 #4
0
        public void AttackingWithABrokenWeapon()
        {
            //Arrange
            Axe   axe   = new Axe(1, 1);
            Dummy dummy = new Dummy(10, 10);

            //Act
            axe.Attack(dummy);

            //Assert
            Assert.That(
                () => axe.Attack(dummy),
                Throws
                .InvalidOperationException
                .With
                .Message
                .EqualTo("Axe is broken."));

            Assert
            .Throws <InvalidOperationException>(
                () => axe.Attack(dummy));
            Assert
            .Throws(
                typeof(InvalidOperationException),
                () => axe.Attack(dummy));
        }
예제 #5
0
    public void AxeLoosesDurabilityAfterAttack()
    {
        axe.Attack(dummy);
        int expectedDurability = durabilityPoints - 1;

        Assert.That(axe.DurabilityPoints, Is.EqualTo(expectedDurability), "Axe Durability doesn't change after attack.");
    }
예제 #6
0
        public void AxeAttackWhenBroken()
        {
            systemUnderTest = new Axe(1, 1);

            systemUnderTest.Attack(dummy);

            Assert.Throws <InvalidOperationException>(() => systemUnderTest.Attack(dummy), "Axe is broken");
        }
예제 #7
0
    public static void Main(string[] args)
    {
        Axe   axe   = new Axe(10, 10);
        Dummy dummy = new Dummy(10, 100);

        axe.Attack(dummy);
        axe.Attack(dummy);
    }
예제 #8
0
        public void DummyLosesHealthWhenAttacked()
        {
            dummy = new Dummy(10, 10);

            axe.Attack(dummy);

            Assert.AreEqual(9, dummy.Health, "Dummy does not lose health when attacked");
        }
예제 #9
0
    public void WhenDummyAttacked_ShouldLoseHealth()
    {
        int dummyHealth = dummy.Health;

        axe.Attack(dummy);

        Assert.That(dummy.Health, Is.EqualTo(dummyHealth - axe.AttackPoints));
    }
예제 #10
0
    public void AxeLoosesDurabilityAfterAttack()
    {
        axe.Attack(target);
        int expectedDurability = 1;

        Assert.That(axe.DurabilityPoints, Is.EqualTo(expectedDurability)
                    , "Axe does not loose durability.");
    }
예제 #11
0
    public void ABrokenAxeCantAttack()
    {
        Axe axe = new Axe(AxeAttack, 1);

        axe.Attack(this.dummy);

        Assert.That(() => axe.Attack(this.dummy), Throws.InvalidOperationException.With.Message.EqualTo("Axe is broken."));
    }
예제 #12
0
        public void AxeLosesDurabilityAfterAttack()
        {
            var expectedDurability = axe.AttackPoints - 1;

            axe.Attack(dummy);

            Assert.That(axe.DurabilityPoints, Is.EqualTo(expectedDurability));
        }
        public void AxeLosesDurabilityAfterAttack()
        {
            //Act
            axe.Attack(dummy);

            //Assert
            Assert.That(axe.DurabilityPoints, Is.EqualTo(1), "Axe Durability doesn't change after attack");
        }
예제 #14
0
        public void CheckIfAbleToAttackWithBrokenAxe()
        {
            Axe axe = new Axe(10, 1);

            axe.Attack(this.dummy);

            Assert.That(() => axe.Attack(this.dummy), Throws.InvalidOperationException.With.Message.EqualTo("Axe is broken."));
        }
예제 #15
0
    public void DeadDummyThrowsExceptionIfAttacked()
    {
        var axe = new Axe(20, 100);

        axe.Attack(this.dummy);

        Assert.That(() => axe.Attack(this.dummy),
                    Throws.InvalidOperationException.With.Message.EqualTo("Dummy is dead."));
    }
예제 #16
0
        public void AxeAttackingWithBrokenWapon()
        {
            Axe   axe   = new Axe(10, 1);
            Dummy dummy = new Dummy(10, 10);

            axe.Attack(dummy);

            Assert.Catch <InvalidOperationException>(() => axe.Attack(dummy));
        }
예제 #17
0
        public void DummyIsAttackedWithBrokenWeapon()
        {
            Axe   axe   = new Axe(axeAttackPoints, secondTestAxeDurability);
            Dummy dummy = new Dummy(dummyHealth, dummyExperience);

            axe.Attack(dummy);

            Assert.That(() => axe.Attack(dummy), Throws.InvalidOperationException.With.Message.EqualTo("Axe is broken."));
        }
예제 #18
0
        // [Test]
        public void Attack_AttackWithBrokenAxe_ExceptionTrown()
        {
            var axe = new Axe(10, 1);

            // var dummy = new Dummy(10, 15);

            axe.Attack(dummy);
            Assert.That(() => axe.Attack(dummy), Throws.InvalidOperationException.With.Message.EqualTo("Axe is broken."));
        }
예제 #19
0
        public void BrokenAxeCantAttack()
        {
            axe = new Axe(2, 2);

            axe.Attack(dummy);
            axe.Attack(dummy);

            Assert.Throws <InvalidOperationException>((() => axe.Attack(dummy)), "Broken axes cannot attack");
        }
예제 #20
0
        public void DummyHasToLoseHealthIfAttacked()
        {
            var initialHealth = dummy.Health;

            axe.Attack(dummy);
            var afterAttackHealth = dummy.Health;

            Assert.IsTrue(initialHealth > afterAttackHealth, "Dummy does not loose health");
        }
예제 #21
0
    public void When_AxeDurabilityPointsAreZero_ShouldThrowException()
    {
        Axe   axe   = new Axe(5, 1);
        Dummy dummy = new Dummy(50, 10);

        axe.Attack(dummy);

        Assert.That(() => axe.Attack(dummy), Throws.InvalidOperationException.With.Message.EqualTo("Axe is broken."));
    }
예제 #22
0
        public void BrokenAxeCannotAttack()
        {
            Axe   axe   = new Axe(1, 2);
            Dummy dummy = new Dummy(10, 1);

            axe.Attack(dummy);
            axe.Attack(dummy);
            Assert.Throws <InvalidOperationException>(() => axe.Attack(dummy));
        }
예제 #23
0
        public void AtackWithBrokenWeapon()
        {
            Axe   axe   = new Axe(10, 0);
            Dummy dummy = new Dummy(10, 10);

            axe.Attack(dummy);

            Assert.Throws <InvalidOperationException>(() => axe.Attack(dummy));
        }
예제 #24
0
        public void AreDummyIsDead()
        {
            var axe   = new Axe(10, 10);
            var dummy = new Dummy(10, 10);

            axe.Attack(dummy);

            Assert.Throws <InvalidOperationException>(() => axe.Attack(dummy));
        }
예제 #25
0
    public void BrokenAxeCantAttack()
    {
        Axe   axe   = new Axe(1, 1);
        Dummy dummy = new Dummy(10, 10);

        axe.Attack(dummy);

        Assert.That(() => axe.Attack(dummy), Throws.InvalidOperationException.With.Message.EqualTo("Axe is broken."));
    }
예제 #26
0
        public void DeadDummyThrowsExceptionIfAttacked()
        {
            Dummy dummy = new Dummy(5, 5);
            Axe   axe   = new Axe(10, 10);

            axe.Attack(dummy);

            Assert.Throws <InvalidOperationException>(() => axe.Attack(dummy), "Dead dummy does not throw exception when attacked.");
        }
예제 #27
0
        public void AttackWithBrokenWeapon()
        {
            var axe   = new Axe(1, 1);
            var dummy = new Dummy(20, 20);

            axe.Attack(dummy);

            Assert.Throws <InvalidOperationException>(() => axe.Attack(dummy));
        }
예제 #28
0
        public void DummyTests()
        {
            Axe   axe   = new Axe(8);
            Dummy dummy = new Dummy(1);

            axe.Attack(dummy);
            axe.Attack(dummy);
            axe.Attack(dummy);
            Assert.AreEqual(axe.DurabilityPoints, 9, "Axe Durability doesn't change after attack.");
        }
예제 #29
0
    public void BrokenAxeCantAttack()
    {
        // Act
        axe.Attack(dummy);
        axe.Attack(dummy);

        // Assert
        var ex = Assert.Throws <InvalidOperationException>(() => axe.Attack(dummy));

        Assert.That(ex.Message, Is.EqualTo("Axe is broken."));
    }
예제 #30
0
        public void BrokenAxeCantAtack()
        {
            Axe   axe   = new Axe(2, 2);
            Dummy dummy = new Dummy(20, 20);

            axe.Attack(dummy);
            axe.Attack(dummy);
            var ex = Assert.Throws <InvalidOperationException>(() => axe.Attack(dummy));

            Assert.That(ex.Message, Is.EqualTo("Axe is broken."));
        }