public void ItFiresTheAttackedEventWhenItsAttacked() { var unity = Substitute.For <UnityObject>(); var conflictResolver = Substitute.For <ConflictResolver>(); var unit = new StandardUnit(conflictResolver, unity); bool attacked = false; unit.Attacked += () => attacked = true; unit.AttackWith(unit); Assert.IsTrue(attacked); }
public void ItLosesTheDamageBasedOnTheUnits() { var unit = Substitute.For <Unit>(); unity.InitialHealth.Returns(10); var cellPhone = new StandardUnit(conflictResolver, unity); unit.AttackStrengthAgainst(cellPhone).Returns(1); cellPhone.AttackWith(unit); Assert.AreEqual(9, cellPhone.Health); }
public void ItDoesNotFireTheDeadEventWhenItDoesntDie() { var unity = Substitute.For<UnityObject>(); unity.InitialHealth.Returns(10); var conflictResolver = Substitute.For<ConflictResolver>(); var unit = new StandardUnit(conflictResolver, unity); conflictResolver.Resolve(unit, unit).Returns(1); bool dead = false; unit.Dead += () => dead = true; unit.AttackWith(unit); Assert.IsFalse(dead); }
public void ItFiresTheDeadEventWhenItDies() { var unity = Substitute.For <UnityObject>(); unity.InitialHealth.Returns(1); var conflictResolver = Substitute.For <ConflictResolver>(); var unit = new StandardUnit(conflictResolver, unity); conflictResolver.Resolve(unit, unit).Returns(1); bool dead = false; unit.Dead += () => dead = true; unit.AttackWith(unit); Assert.IsTrue(dead); }
public void ItFiresTheAttackedEventWhenItsAttacked() { var unity = Substitute.For<UnityObject>(); var conflictResolver = Substitute.For<ConflictResolver>(); var unit = new StandardUnit(conflictResolver, unity); bool attacked = false; unit.Attacked += () => attacked = true; unit.AttackWith(unit); Assert.IsTrue(attacked); }
public void ItLosesTheDamageBasedOnTheUnits() { var unit = Substitute.For<Unit>(); unity.InitialHealth.Returns(10); var cellPhone = new StandardUnit(conflictResolver, unity); unit.AttackStrengthAgainst(cellPhone).Returns(1); cellPhone.AttackWith(unit); Assert.AreEqual(9, cellPhone.Health); }