示例#1
0
 public void InitializeTests()
 {
     var powerGenerator = new PowerGenerator();
     var weaponFactory = new WeaponFactory();
     var combatantFactory = new CombatantFactory(powerGenerator, weaponFactory);
     this.armyA = new Army(powerGenerator, combatantFactory) { Health = 100 };
     this.armyB = new Army(powerGenerator, combatantFactory) { Health = 100 };
     this.warLogic = new WarLogic();
 }
示例#2
0
        /// <summary>
        /// Selects an action based on the printed menu.
        /// </summary>
        /// <param name="menuOption"></param>
        public static void SelectFromMenu(string menuOption)
        {
            if (string.IsNullOrEmpty(menuOption)) throw new ArgumentNullException("menuOption");

            switch (menuOption)
            {
                case "A":
                    var powerGenerator = new PowerGenerator();
                    var armyA = new Army(powerGenerator) { Name = "England", Health = 100 };
                    var armyB = new Army(powerGenerator) { Name = "Rome", Health = 100 };
                    var warLogic = new WarLogic();
                    warLogic.OnWarEnding += OnWarEnding;
                    warLogic.GoToWar(armyA, armyB);
                    break;
                case "Q":
                    Console.WriteLine("Quitting the game.");
                    break;
                default:
                    throw new ArgumentException(string.Format("Unknown parameter value: {0}", menuOption), "menuOption");
            }
        }
示例#3
0
 public void TestSetup()
 {
     var powerGenerator = new PowerGenerator();
     var weaponFactory = new WeaponFactory();
     var combatantFactory = new CombatantFactory(powerGenerator, weaponFactory);
     this.army = new Army(powerGenerator, combatantFactory) { Health = 100 };
     this.enemyArmy = new Army(powerGenerator, combatantFactory) { Health = 100 };
 }