comparison API/Util/UnitEquipmentUtilTest.cs @ 32:9bf542b76de2

Re #209: equipmentslot Value problem * Update unit tests to match new "check percentage, ignore numbers" max percentage calculation
author IBBoard <dev@ibboard.co.uk>
date Fri, 13 Nov 2009 11:24:55 +0000
parents c6082e4018f7
children c026c02583ca
comparison
equal deleted inserted replaced
31:c6082e4018f7 32:9bf542b76de2
324 UnitEquipmentItem equip2 = new MockPercentageAmountUnitEquipmentItem(new MockEquipmentItem("equip2"), unitType); 324 UnitEquipmentItem equip2 = new MockPercentageAmountUnitEquipmentItem(new MockEquipmentItem("equip2"), unitType);
325 equip2.SlotName = SLOT_NAME; 325 equip2.SlotName = SLOT_NAME;
326 unit.SetEquipmentAmount(equip2, 5); 326 unit.SetEquipmentAmount(equip2, 5);
327 Assert.AreEqual(3, UnitEquipmentUtil.GetMaxEquipmentCount(unit, equip)); 327 Assert.AreEqual(3, UnitEquipmentUtil.GetMaxEquipmentCount(unit, equip));
328 Assert.AreEqual(3, UnitEquipmentUtil.GetMinEquipmentCount(unit, equip)); 328 Assert.AreEqual(3, UnitEquipmentUtil.GetMinEquipmentCount(unit, equip));
329 Assert.AreEqual(IBBMath.Percentage(3, 15), UnitEquipmentUtil.GetMaxEquipmentPercentage(unit, equip)); 329 Assert.AreEqual(50 - IBBMath.Percentage(5, 15), UnitEquipmentUtil.GetMaxEquipmentPercentage(unit, equip));
330 Assert.AreEqual(50 - IBBMath.Percentage(5, 15), UnitEquipmentUtil.GetMinEquipmentPercentage(unit, equip)); 330 Assert.AreEqual(50 - IBBMath.Percentage(5, 15), UnitEquipmentUtil.GetMinEquipmentPercentage(unit, equip));
331 } 331 }
332 332
333 [Test()] 333 [Test()]
334 public void TestGetEquipmentCountsForPercentageLimitItemOnPercentageLimitedSlotWithExistingEquipmentOfSameType() 334 public void TestGetEquipmentCountsForPercentageLimitItemOnPercentageLimitedSlotWithExistingEquipmentOfSameType()
356 UnitEquipmentItem equip2 = new MockPercentageAmountUnitEquipmentItem(new MockEquipmentItem("equip2"), unitType); 356 UnitEquipmentItem equip2 = new MockPercentageAmountUnitEquipmentItem(new MockEquipmentItem("equip2"), unitType);
357 equip2.SlotName = SLOT_NAME; 357 equip2.SlotName = SLOT_NAME;
358 unit.SetEquipmentAmount(equip2, 5); 358 unit.SetEquipmentAmount(equip2, 5);
359 Assert.AreEqual(3, UnitEquipmentUtil.GetMaxEquipmentCount(unit, equip)); 359 Assert.AreEqual(3, UnitEquipmentUtil.GetMaxEquipmentCount(unit, equip));
360 Assert.AreEqual(1, UnitEquipmentUtil.GetMinEquipmentCount(unit, equip)); 360 Assert.AreEqual(1, UnitEquipmentUtil.GetMinEquipmentCount(unit, equip));
361 Assert.AreEqual(IBBMath.Percentage(3, 15), UnitEquipmentUtil.GetMaxEquipmentPercentage(unit, equip)); 361 Assert.AreEqual(50 - IBBMath.Percentage(5, 15), UnitEquipmentUtil.GetMaxEquipmentPercentage(unit, equip));
362 Assert.AreEqual(10, UnitEquipmentUtil.GetMinEquipmentPercentage(unit, equip)); 362 Assert.AreEqual(10, UnitEquipmentUtil.GetMinEquipmentPercentage(unit, equip));
363 } 363 }
364 364
365 [Test()] 365 [Test()]
366 public void TestIsEquipmentRatioLimitsWithRatioLimitedEquipmentAndUnlimitedSlot() 366 public void TestIsEquipmentRatioLimitsWithRatioLimitedEquipmentAndUnlimitedSlot()