Ejemplo n.º 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."));
        }
Ejemplo n.º 2
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);
        }
Ejemplo n.º 3
0
        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));
        }
Ejemplo n.º 4
0
        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.");
        }