Пример #1
0
        public GangWeapon AddGangWeapon([FromUri] string gangId, GangWeapon gangWeapon)
        {
            if (!_gangManager.Spend(gangId, gangWeapon.Cost))
            {
                return(null);
            }

            return(_weaponManager.AddGangWeapon(gangWeapon));
        }
Пример #2
0
        public void GangWeaponsTest()
        {
            var gangId     = "1";
            var gangWeapon = new GangWeapon()
            {
                GangId = gangId,
                Weapon = new Weapon()
                {
                    WeaponId = (WeaponEnum)1
                },
                Cost = 10
            };

            Assert.AreEqual(0, _weaponManager.GetGangStash(gangId).Count());

            var returnedWeapon = _weaponManager.AddGangWeapon(gangWeapon);

            Assert.AreEqual("DDDD-EEEE-FFFF", returnedWeapon.GangWeaponId);
            Assert.AreEqual(1, _weaponManager.GetGangStash(gangId).Count());

            _weaponManager.RemoveGangWeapon("DDDD-EEEE-FFFF");
            Assert.AreEqual(0, _weaponManager.GetGangStash(gangId).Count());
        }
Пример #3
0
 /// <summary>
 /// Buy equipment
 /// </summary>
 /// <param name="equipment">Equipment</param>
 public void BuyEquipment(GangWeapon equipment)
 {
     // TODO: Add some validation to ensure cost is correct.
     _gangManager.Spend(equipment.GangId, equipment.Cost);
     _weaponManager.AddGangWeapon(equipment);
 }