public void WhenLondonIsBeingInvaded() { var random = new Random(); var weapons = new List<IDefenceWeapon> { CreateDefenceWeapon(DefenceWeaponType.Peashooter1000Blaster), CreateDefenceWeapon(DefenceWeaponType.Peashooter1000Blaster), CreateDefenceWeapon(DefenceWeaponType.Peashooter1000Blaster), CreateDefenceWeapon(DefenceWeaponType.Peashooter1000Blaster), CreateDefenceWeapon(DefenceWeaponType.Peashooter1000Blaster) }; var defender = new EarthDefender(); for (var wave = 1; wave <= 20; wave++) { var numberOfInvaders = random.Next(5) + 1; var invasionWave = CreateInvasionWave(numberOfInvaders, weapons); var defenceStrategy = defender.DefendEarth(invasionWave); Assert.That(defenceStrategy.WeaponsToFireAtThisWave.Count(), Is.EqualTo(numberOfInvaders)); } }
public void WhenLondonIsBeingInvaded() { var random = new Random(); var weapons = new List <IDefenceWeapon> { CreateDefenceWeapon(DefenceWeaponType.Peashooter1000Blaster), CreateDefenceWeapon(DefenceWeaponType.Peashooter1000Blaster), CreateDefenceWeapon(DefenceWeaponType.Peashooter1000Blaster), CreateDefenceWeapon(DefenceWeaponType.Peashooter1000Blaster), CreateDefenceWeapon(DefenceWeaponType.Peashooter1000Blaster) }; var defender = new EarthDefender(); for (var wave = 1; wave <= 20; wave++) { var numberOfInvaders = random.Next(5) + 1; var invasionWave = CreateInvasionWave(numberOfInvaders, weapons); var defenceStrategy = defender.DefendEarth(invasionWave); Assert.That(defenceStrategy.WeaponsToFireAtThisWave.Count(), Is.EqualTo(numberOfInvaders)); } }
public void WhenBeingInvadedByAliensThenAmatchingNumberOfWeaponsAreReturned(int numberOfAliens) { var weapons = new List<IDefenceWeapon> { CreateDefenceWeapon(DefenceWeaponType.Peashooter500Blaster), CreateDefenceWeapon(DefenceWeaponType.Peashooter500Blaster), CreateDefenceWeapon(DefenceWeaponType.Peashooter500Blaster), CreateDefenceWeapon(DefenceWeaponType.Peashooter500Blaster), CreateDefenceWeapon(DefenceWeaponType.Peashooter500Blaster), CreateDefenceWeapon(DefenceWeaponType.Peashooter500Blaster), CreateDefenceWeapon(DefenceWeaponType.Peashooter500Blaster), CreateDefenceWeapon(DefenceWeaponType.Peashooter500Blaster), CreateDefenceWeapon(DefenceWeaponType.Peashooter500Blaster), CreateDefenceWeapon(DefenceWeaponType.Peashooter500Blaster) }; var defender = new EarthDefender(); var numberOfInvaders = numberOfAliens; var invasionWave = CreateInvasionWave(numberOfInvaders, weapons); var defenceStrategy = defender.DefendEarth(invasionWave); Assert.That(defenceStrategy.WeaponsToFireAtThisWave.Count(), Is.EqualTo(numberOfAliens)); }