public void InitWaveWitParameters() { ZombieParameter[] zombieParameters = { new ZombieParameter(ZombieType.Fatty, ZombieTrait.Normal, 3) }; List <Order> orders = new List <Order> { new Order(0, 0, OrderType.RecruitSoldier), new Order(0, 0, OrderType.EquipWithShotgun) }; City city = new City(); DamageDispatcher damageDispatcher = new DamageDispatcher(new ItemSelector()); Wave wave = new Wave(zombieParameters, city, orders, damageDispatcher); Assert.True(wave.Horde.IsAlive); Assert.Equal(3, wave.Horde.ZombiesAlive.Count); Assert.Equal(2, wave.Orders.Count); Assert.Empty(wave.TurnResults); Assert.Equal(damageDispatcher, wave.DamageDispatcher); Assert.Equal(city, wave.City); Assert.NotNull(wave.InitialResult); Assert.NotNull(wave.WaveEngine); }
public void TestDamageDispatcherOverkill() { DamageDispatcher dispatcher = new DamageDispatcher(new ItemSelector()); List <ISoldier> soldiers = new List <ISoldier>(); Soldier s = new Soldier(1, new Squad()); soldiers.Add(s); Assert.True(s.HealthPoints == 4); dispatcher.DispatchDamage(s.HealthPoints + 1, soldiers); Assert.True(s.HealthPoints == 0); }
public void TestDamageDispatcherDispatchAllDamage() { Squad squad = new Squad(); DamageDispatcher dispatcher = new DamageDispatcher(new ItemSelector()); squad.RecruitSoldier(); squad.RecruitSoldier(); int damageToDeal = 6; int sumHPInit = squad.SoldiersAlive.Sum(soldier => soldier.HealthPoints); dispatcher.DispatchDamage(damageToDeal, squad.SoldiersAlive); Assert.True(squad.SoldiersAlive.Sum(soldier => soldier.HealthPoints) == (sumHPInit - damageToDeal)); }