public void BattleSimulatorSetup() { int size = 3; string[] monkeyCompo = new string[] { "Flying Monkey", "Monkey" }; string[] wizardCompo = new string[] { "Wizard" }; this.monkeyArmy = new Army(); monkeyArmy.Composition = monkeyCompo; monkeyArmy.Name = "Monkey Army"; monkeyArmy.Size = size; this.wizardArmy = new Army(); wizardArmy.Composition = wizardCompo; wizardArmy.Name = "Wizard Army"; wizardArmy.Size = size; TroopFactory factory = MockTroopFactory.Create(); ArmyComposer composer = new ArmyComposer(factory); monkeyArmy.Troops = composer.Compose(monkeyArmy); wizardArmy.Troops = composer.Compose(wizardArmy); }
public void DuelTest_NotPreferred() { TroopFactory factory = MockTroopFactory.Create(); Troop a = factory.Create("Monkey"); Troop b = factory.Create("Balloon"); int expectedB = b.Info.Health - a.Info.Damage / 2; string result = DuelSimulator.Duel(a, b); Assert.AreEqual(expectedB, b.CurrentHealth); Console.WriteLine(result); }
public void DuelTest_Overkill() { TroopFactory factory = MockTroopFactory.Create(); Troop a = factory.Create("Wizard"); Troop b = factory.Create("Balloon"); a.CurrentHealth = 1; int expectedB = b.Info.Health - a.Info.Damage; string result = DuelSimulator.Duel(a, b); Assert.IsTrue(result.Contains("Wizard was killed")); Assert.AreEqual(1, b.InflictedDamage); //Ensure we don't 'overkill' on calculating inflicted damage Console.WriteLine(result); }
public void CommanderSetup() { int size = 7; string[] composition = new string[] { "Monkey", "Balloon", "Wizard" }; army = new Army(); army.Composition = composition; army.Name = "Test Army"; army.Size = size; TroopFactory factory = MockTroopFactory.Create(); ArmyComposer composer = new ArmyComposer(factory); army.Troops = composer.Compose(army); }
public void ComposeTest() { int size = 7; string[] composition = new string[] { "Monkey", "Balloon", "Wizard" }; Army army = new Army(); army.Composition = composition; army.Name = "Test Army"; army.Size = size; string[] expected = new string[] { "Monkey", "Balloon", "Wizard", "Monkey", "Balloon", "Wizard", "Monkey" }; TroopFactory factory = MockTroopFactory.Create(); ArmyComposer composer = new ArmyComposer(factory); List <Troop> troops = composer.Compose(army); List <string> troopNames = troops.Select(x => x.Info.Name).ToList(); Assert.AreEqual(expected, troopNames.ToArray()); }