public void MoveTo_DefeatsTheAttacker_BecauseTheDefenderIsVictorious(IUnit<Archer> attacker, IUnit defender) { // :::: ARRANGE :::: var stubUnits = StubWorld.Units(new[] { attacker, defender }); var stubCombat = StubCombat(attacker, defender, CombatOutcome.DefenderIsVictorious); var combatEngagingUnit = new OneToOneCombatEngagement<Archer>(attacker, stubUnits, stubCombat); // :::: ACT :::: var destination = defender.Location; combatEngagingUnit.MoveTo(destination); // :::: ASSERT :::: stubUnits.Should().Equal(defender); }
public void MoveTo_IsForwardedAfterTheAttackingUnitDefeatsTheDefendingUnit() { // :::: ARRANGE :::: var spyUnit = A.Fake<IUnit<Archer>>(); var stubUnits = StubWorld.Units(new[] { spyUnit, Red.Archer().At(0, 0) }); var stubCombat = A.Fake<IUnitCombat>(); var combatEngagingUnit = new OneToOneCombatEngagement<Archer>(spyUnit, stubUnits, stubCombat); A.CallTo(() => stubCombat.CombatOutcome(A<IUnit>._, A<IUnit>._)).Returns(CombatOutcome.AttackerIsVictorious); // :::: ACT :::: combatEngagingUnit.MoveTo(DummyPosition); // :::: ASSERT :::: A.CallTo(() => spyUnit.MoveTo(DummyPosition)).MustHaveHappened(); }