Ejemplo n.º 1
0
		public void PlaceObjectTest()
		{
			IGameObject obj = new Ammo();
			Field target = new Floor(0, 0);
			Assert.IsTrue(target.placeObject(obj));
			Field targe2 = new Wall(0, 0);
			Assert.IsFalse(targe2.placeObject(obj));
		}
Ejemplo n.º 2
0
		public void PlaceMultipleObjectsTest()
		{
			IGameObject thing = new Ammo();
			IGameObject thing2 = new Ammo();
			Field target = new Floor(0, 0);

			Assert.IsTrue(target.placeObject(thing));
			Assert.IsTrue(target.placeObject(thing2));
		}
		public void AmmoPickupTest()
		{
			Ammo moneyPickup = new Ammo() { Bullets = 4, Grenades = 1 };
			map[0, 0].placeObject(moneyPickup);
			int playerBullets = player.RangedWeapon.Ammo;
			int playerGrenades = player.GrenadeWeapon.Ammo;
			new PickupCommand(player).execute();
			Assert.AreEqual(player.RangedWeapon.Ammo, playerBullets + 4);
			Assert.AreEqual(player.GrenadeWeapon.Ammo, playerGrenades + 1);
		}
		public void MiltipleObjectPickupsTest()
		{
			Ammo ammoPickup = new Ammo() { Bullets = 4, Grenades = 1 };
			map[0, 0].placeObject(ammoPickup);
			int playerBullets = player.RangedWeapon.Ammo;
			int playerGrenades = player.GrenadeWeapon.Ammo;
			MeleeWeapon weaponPickup = new MeleeWeapon() { Damage = 5 };
			map[0, 0].placeObject(weaponPickup);
			new PickupCommand(player).execute();
			Assert.AreEqual(player.RangedWeapon.Ammo, playerBullets + 4);
			Assert.AreEqual(player.GrenadeWeapon.Ammo, playerGrenades + 1);
			Assert.AreEqual(weaponPickup, player.MeleeWeapon);
		}