示例#1
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."));
        }
示例#2
0
        public void BrokenAxeCantAttack()
        {
            Axe axe = new Axe(ATTACKS_POINTS, 0);

            Assert.That(() => axe.Attack(dummy),
                        Throws.InvalidOperationException
                        .With.Message.EqualTo(AXE_BROKEN_MSG));
        }
示例#3
0
        public void AxeLoosesDurabilityAfterAttack()
        {
            Axe   axe   = new Axe(10, 10);
            Dummy dummy = new Dummy(10, 10);

            axe.Attack(dummy);

            Assert.That(axe.DurabilityPoints, Is.EqualTo(9), "Axe Durability doesn't change after attack.");
        }
示例#4
0
        public void AxeLoosesDurabilityAfterAttack()
        {
            // Arrange
            Axe axe = new Axe(ATTACKS_POINTS, 10);

            // Act
            axe.Attack(this.dummy);

            // Assert
            Assert.That(axe.DurabilityPoints, Is.EqualTo(9), AXE_DURABILITY_RESULT_FAILED_MSG);
        }
        public void AxeThrowsExceptionIfBboken()
        {
            const int Health     = 10;
            const int Experience = 10;
            const int Attack     = 10;
            const int Durability = 0;

            Dummy dummy = new Dummy(Health, Experience);
            Axe   axe   = new Axe(Attack, Durability);

            Assert.Throws <InvalidOperationException>(() => axe.Attack(dummy));
        }
        public void AxeLosesDurabilityAfterAttack()
        {
            const int Health     = 10;
            const int Experience = 10;
            const int Attack     = 10;
            const int Durability = 10;

            Dummy dummy = new Dummy(Health, Experience);
            Axe   axe   = new Axe(Attack, Durability);

            axe.Attack(dummy);
            int expectedDurability = 9;

            Assert.That(expectedDurability.Equals(axe.DurabilityPoints), "Axe Durability doesn't change after attack.");
        }