Beispiel #1
0
    public void PerformMissionTest()
    {
        IArmy army = new Army();

        army.AddSoldier(new Corporal("Pepo", 12, 23, 2));
        army.AddSoldier(new Corporal("Ricky", 29, 29, 20));
        IWareHouse wareHouse = new WareHouse();

        wareHouse.AddAmmunitions("AutomaticMachine", 12);
        wareHouse.AddAmmunitions("Gun", 3);
        wareHouse.AddAmmunitions("Helmet", 5);
        wareHouse.AddAmmunitions("Knife", 12);
        wareHouse.AddAmmunitions("MachineGun", 3);
        wareHouse.AddAmmunitions("NightVision", 5);
        wareHouse.AddAmmunitions("RPG", 56);
        MissionController mc = new MissionController(army, wareHouse);

        mc.Missions.Enqueue(new Easy(12.5));
        mc.Missions.Enqueue(new Hard(56));
        mc.Missions.Enqueue(new Hard(5));
        mc.Missions.Enqueue(new Hard(6));

        string res = mc.PerformMission(new Easy(23));
        int    n   = res.Length;

        Assert.AreEqual(229, n);
    }
    public void InitialTest()
    {
        IArmy army = new Army();

        army.AddSoldier(new Ranker("Ivan", 47, 23, 100));
        army.AddSoldier(new Corporal("Ivaylo", 21, 78, 100));

        IAmmunitionFactory ammunitionFactory = new AmmunitionFactory();

        IWareHouse warehouse = new WareHouse(ammunitionFactory);

        warehouse.AddAmmunitions("Gun", 2);
        warehouse.AddAmmunitions("AutomaticMachine", 2);
        warehouse.AddAmmunitions("MachineGun", 1);
        warehouse.AddAmmunitions("Helmet", 2);
        warehouse.AddAmmunitions("Knife", 1);

        this.controller = new MissionController(army, warehouse);
    }