public void Attack_WhenAttacksHerself_ReturnsUnalteredHealth() { FakeCharacter me = new FakeCharacter(); AttackService sut = new AttackService(); sut.Attack(100, me, me); Assert.Equal(1000, me.HealthPoints); }
public void Attack_WhenCauseDamageToAThing_ReturnsSubtractedHealth() { FakeCharacter me = new FakeCharacter(); Thing enemy = new Thing(1000); AttackService sut = new AttackService(); sut.Attack(100, me, enemy); Assert.Equal(900, enemy.HealthPoints); }
public void AttackService_DefenderWins() { // Arrange var attackService = new AttackService(new DefenderWinsRandomGen()); // Act int attackerUnits = 2; int defenderUnits = 2; int attackerUnitsLost; int defenderUnitsLost; var result = attackService.Attack( attackerUnits, defenderUnits, out attackerUnitsLost, out defenderUnitsLost); // Assert Assert.IsFalse(result); Assert.AreEqual(attackerUnits, attackerUnitsLost); Assert.AreEqual(0, defenderUnitsLost); }
public void Attack_WhenCharactersArentAllies_ReturnsSubtractedHealth() { Faction faction = new Faction(1); Faction faction2 = new Faction(2); FakeCharacter character = new FakeCharacter(); character.JoinFaction(faction); FakeCharacter character2 = new FakeCharacter(); character2.JoinFaction(faction2); AttackService sut = new AttackService(); sut.Attack(100, character, character2); Assert.Equal(900, character2.HealthPoints); }
public void AttackService_DefenderWinsForEvenDiceRolls() { // Arrange var randomService = new PredefinedRandomGen(6, 6); var attackService = new AttackService(randomService); // Act int attackerUnits = 2; int defenderUnits = 2; int attackerUnitsLost; int defenderUnitsLost; var result = attackService.Attack( attackerUnits, defenderUnits, out attackerUnitsLost, out defenderUnitsLost); // Assert Assert.IsFalse(result); Assert.AreEqual(attackerUnits, attackerUnitsLost); Assert.AreEqual(0, defenderUnitsLost); }