changeset 26:e6bf9b5e1b94

Re #198: Add equipment slots * Alter constructors of mock percentage unit equipment items for more flexibility * Consolidate tests * Add full set of tests for getting max percentage * Add extra tests to handle different limits
author IBBoard <dev@ibboard.co.uk>
date Wed, 28 Oct 2009 20:43:33 +0000
parents d48e73488838
children 0676f6a1ee9d
files API/Objects/Mock/MockPercentageAmountUnitEquipmentItem.cs API/Util/UnitEquipmentUtilTest.cs
diffstat 2 files changed, 228 insertions(+), 70 deletions(-) [+]
line wrap: on
line diff
--- a/API/Objects/Mock/MockPercentageAmountUnitEquipmentItem.cs	Tue Oct 27 20:57:49 2009 +0000
+++ b/API/Objects/Mock/MockPercentageAmountUnitEquipmentItem.cs	Wed Oct 28 20:43:33 2009 +0000
@@ -14,17 +14,22 @@
 		{
 		}
 		
-		public MockPercentageAmountUnitEquipmentItem(double percentage) : this(new MockEquipmentItem(), new MockUnitType(), percentage)
+		public MockPercentageAmountUnitEquipmentItem(double percentage) : this(percentage, percentage)
+		{
+		}
+		
+		public MockPercentageAmountUnitEquipmentItem(double min, double max) : this(new MockEquipmentItem(), new MockUnitType(), min, max)
 		{
 		}
 		
-		public MockPercentageAmountUnitEquipmentItem(EquipmentItem item, UnitType type) : this(item, type, 50)
+		public MockPercentageAmountUnitEquipmentItem(EquipmentItem item, UnitType type) : this(item, type, 50, 50)
 		{
 		}
 		
-		public MockPercentageAmountUnitEquipmentItem(EquipmentItem item, UnitType type, double percentage) : base(item, type)
+		public MockPercentageAmountUnitEquipmentItem(EquipmentItem item, UnitType type, double min, double max) : base(item, type)
 		{
-			MaxLimit = new SimpleRoundedPercentageLimit(percentage, false);
+			MinLimit = new SimpleRoundedPercentageLimit(min, false);
+			MaxLimit = new SimpleRoundedPercentageLimit(max, false);
 		}
 	}
 }
--- a/API/Util/UnitEquipmentUtilTest.cs	Tue Oct 27 20:57:49 2009 +0000
+++ b/API/Util/UnitEquipmentUtilTest.cs	Wed Oct 28 20:43:33 2009 +0000
@@ -13,124 +13,295 @@
 	[TestFixture()]
 	public class UnitEquipmentUtilTest
 	{
+		private const string SLOT_NAME = "slot";
+		
 		[Test()]
 		public void TestGetEquipmentCountsForFixedLimitItemOnDefaultSlot()
 		{
-			UnitEquipmentItem equip = new MockNumericAmountUnitEquipmentItem(3);
+			UnitEquipmentItem equip = new MockNumericAmountUnitEquipmentItem(4);
 			UnitType unitType = equip.EquipmentForUnit;
 			Unit unit = GetUnit (unitType);
-			Assert.AreEqual(3, UnitEquipmentUtil.GetMaxEquipmentCount(unit, equip));
-			Assert.AreEqual(3, UnitEquipmentUtil.GetMinEquipmentCount(unit, equip));
+			Assert.AreEqual(4, UnitEquipmentUtil.GetMaxEquipmentCount(unit, equip));
+			Assert.AreEqual(4, UnitEquipmentUtil.GetMinEquipmentCount(unit, equip));
+			Assert.AreEqual(4.0/15*100, UnitEquipmentUtil.GetMaxEquipmentPercentage(unit, equip));
 		}
 		
 		[Test()]
 		public void TestGetEquipmentCountsForFixedLimitItemOnDefaultSlotWithDifferentMinLimit()
 		{
-			UnitEquipmentItem equip = new MockNumericAmountUnitEquipmentItem(1,3);
+			UnitEquipmentItem equip = new MockNumericAmountUnitEquipmentItem(1,4);
 			UnitType unitType = equip.EquipmentForUnit;
 			Unit unit = GetUnit (unitType);
-			Assert.AreEqual(3, UnitEquipmentUtil.GetMaxEquipmentCount(unit, equip));
+			Assert.AreEqual(4, UnitEquipmentUtil.GetMaxEquipmentCount(unit, equip));
 			Assert.AreEqual(1, UnitEquipmentUtil.GetMinEquipmentCount(unit, equip));
+			Assert.AreEqual(4.0/15*100, UnitEquipmentUtil.GetMaxEquipmentPercentage(unit, equip));
 		}
 		
 		[Test()]
 		public void TestGetEquipmentCountsForFixedLimitItemOnNumberLimitedSlot()
 		{
-			UnitEquipmentItem equip = new MockNumericAmountUnitEquipmentItem();
-			equip.MaxLimit = new NumericSizeConstrainedLimit(3);
-			equip.SlotName = "slot";
+			UnitEquipmentItem equip = new MockNumericAmountUnitEquipmentItem(3);
+			equip.SlotName = SLOT_NAME;
 			UnitType unitType = equip.EquipmentForUnit;
-			unitType.AddEquipmentSlot("slot", new AbsoluteNumericLimit(2));
+			unitType.AddEquipmentSlot(SLOT_NAME, new AbsoluteNumericLimit(2));
 			Unit unit = GetUnit(unitType);
 			Assert.AreEqual(2, UnitEquipmentUtil.GetMaxEquipmentCount(unit, equip));
 			Assert.AreEqual(2, UnitEquipmentUtil.GetMinEquipmentCount(unit, equip));
+			Assert.AreEqual(2.0/15*100, UnitEquipmentUtil.GetMaxEquipmentPercentage(unit, equip));
+		}
+		
+		[Test()]
+		public void TestGetEquipmentCountsForFixedLimitItemOnNumberLimitedSlotWithDifferentMinLimit()
+		{
+			UnitEquipmentItem equip = new MockNumericAmountUnitEquipmentItem(1, 3);
+			equip.SlotName = SLOT_NAME;
+			UnitType unitType = equip.EquipmentForUnit;
+			unitType.AddEquipmentSlot(SLOT_NAME, new AbsoluteNumericLimit(2));
+			Unit unit = GetUnit(unitType);
+			Assert.AreEqual(2, UnitEquipmentUtil.GetMaxEquipmentCount(unit, equip));
+			Assert.AreEqual(1, UnitEquipmentUtil.GetMinEquipmentCount(unit, equip));
+			Assert.AreEqual(2.0/15*100, UnitEquipmentUtil.GetMaxEquipmentPercentage(unit, equip));
+		}
+		
+		[Test()]
+		public void TestGetEquipmentCountsForFixedLimitItemOnNumberLimitedSlotWithMaxBelowSlotLimit()
+		{
+			UnitEquipmentItem equip = new MockNumericAmountUnitEquipmentItem(3);
+			equip.SlotName = SLOT_NAME;
+			UnitType unitType = equip.EquipmentForUnit;
+			unitType.AddEquipmentSlot(SLOT_NAME, new AbsoluteNumericLimit(5));
+			Unit unit = GetUnit(unitType);
+			Assert.AreEqual(3, UnitEquipmentUtil.GetMaxEquipmentCount(unit, equip));
+			Assert.AreEqual(3, UnitEquipmentUtil.GetMinEquipmentCount(unit, equip));
+			Assert.AreEqual(3.0/15*100, UnitEquipmentUtil.GetMaxEquipmentPercentage(unit, equip));
 		}
 		
 		[Test()]
+		public void TestGetEquipmentCountsForFixedLimitItemOnNumberLimitedSlotWithMaxBelowSlotLimitWithDifferentMinLimit()
+		{
+			UnitEquipmentItem equip = new MockNumericAmountUnitEquipmentItem(1, 3);
+			equip.SlotName = SLOT_NAME;
+			UnitType unitType = equip.EquipmentForUnit;
+			unitType.AddEquipmentSlot(SLOT_NAME, new AbsoluteNumericLimit(5));
+			Unit unit = GetUnit(unitType);
+			Assert.AreEqual(3, UnitEquipmentUtil.GetMaxEquipmentCount(unit, equip));
+			Assert.AreEqual(1, UnitEquipmentUtil.GetMinEquipmentCount(unit, equip));
+			Assert.AreEqual(3.0/15*100, UnitEquipmentUtil.GetMaxEquipmentPercentage(unit, equip));
+		}
+				
+		[Test()]
 		public void TestGetEquipmentCountsForFixedLimitItemOnPercentageLimitedSlot()
 		{
-			UnitEquipmentItem equip = new MockNumericAmountUnitEquipmentItem();
-			equip.MaxLimit = new NumericSizeConstrainedLimit(7);
-			equip.SlotName = "slot";
+			UnitEquipmentItem equip = new MockNumericAmountUnitEquipmentItem(10);
+			equip.SlotName = SLOT_NAME;
 			UnitType unitType = equip.EquipmentForUnit;
-			unitType.AddEquipmentSlot("slot", new SimpleRoundedPercentageLimit(50, false));
+			unitType.AddEquipmentSlot(SLOT_NAME, new SimpleRoundedPercentageLimit(50, false));
 			Unit unit = GetUnit(unitType);
-			Assert.AreEqual(5, UnitEquipmentUtil.GetMaxEquipmentCount(unit, equip));
+			Assert.AreEqual(7, UnitEquipmentUtil.GetMaxEquipmentCount(unit, equip));
+			Assert.AreEqual(7, UnitEquipmentUtil.GetMinEquipmentCount(unit, equip));
+			Assert.AreEqual(50, UnitEquipmentUtil.GetMaxEquipmentPercentage(unit, equip));
+		}
+		
+		[Test()]
+		public void TestGetEquipmentCountsForFixedLimitItemOnPercentageLimitedSlotWithDifferentMinLimit()
+		{
+			UnitEquipmentItem equip = new MockNumericAmountUnitEquipmentItem(5, 10);
+			equip.SlotName = SLOT_NAME;
+			UnitType unitType = equip.EquipmentForUnit;
+			unitType.AddEquipmentSlot(SLOT_NAME, new SimpleRoundedPercentageLimit(50, false));
+			Unit unit = GetUnit(unitType);
+			Assert.AreEqual(7, UnitEquipmentUtil.GetMaxEquipmentCount(unit, equip));
 			Assert.AreEqual(5, UnitEquipmentUtil.GetMinEquipmentCount(unit, equip));
+			Assert.AreEqual(50, UnitEquipmentUtil.GetMaxEquipmentPercentage(unit, equip));
 		}
 		
 		[Test()]
 		public void TestGetEquipmentCountsForFixedLimitItemOnNumberLimitedSlotWithExistingEquipment()
 		{
-			UnitEquipmentItem equip = new MockNumericAmountUnitEquipmentItem();
-			equip.MaxLimit = new NumericSizeConstrainedLimit(3);
-			equip.SlotName = "slot";
+			UnitEquipmentItem equip = new MockNumericAmountUnitEquipmentItem(3);
+			equip.SlotName = SLOT_NAME;
 			UnitType unitType = equip.EquipmentForUnit;
-			unitType.AddEquipmentSlot("slot", new AbsoluteNumericLimit(6));
+			unitType.AddEquipmentSlot(SLOT_NAME, new AbsoluteNumericLimit(6));
 			Unit unit =GetUnit(unitType);
 			UnitEquipmentItem equip2 = new MockPercentageAmountUnitEquipmentItem(new MockEquipmentItem("equip2"), unitType);
-			equip2.SlotName = "slot";
+			equip2.SlotName = SLOT_NAME;
 			unit.SetEquipmentAmount(equip2, 5);
 			Assert.AreEqual(1, UnitEquipmentUtil.GetMaxEquipmentCount(unit, equip));
 			Assert.AreEqual(1, UnitEquipmentUtil.GetMinEquipmentCount(unit, equip));
+			Assert.AreEqual(1.0/15*100, UnitEquipmentUtil.GetMaxEquipmentPercentage(unit, equip));
+		}
+		
+		[Test()]
+		public void TestGetEquipmentCountsForFixedLimitItemOnNumberLimitedSlotWithExistingEquipmentDifferentMinLimit()
+		{
+			UnitEquipmentItem equip = new MockNumericAmountUnitEquipmentItem(1, 3);
+			equip.SlotName = SLOT_NAME;
+			UnitType unitType = equip.EquipmentForUnit;
+			unitType.AddEquipmentSlot(SLOT_NAME, new AbsoluteNumericLimit(7));
+			Unit unit =GetUnit(unitType);
+			UnitEquipmentItem equip2 = new MockPercentageAmountUnitEquipmentItem(new MockEquipmentItem("equip2"), unitType);
+			equip2.SlotName = SLOT_NAME;
+			unit.SetEquipmentAmount(equip2, 5);
+			Assert.AreEqual(2, UnitEquipmentUtil.GetMaxEquipmentCount(unit, equip));
+			Assert.AreEqual(1, UnitEquipmentUtil.GetMinEquipmentCount(unit, equip));
+			Assert.AreEqual(2.0/15*100, UnitEquipmentUtil.GetMaxEquipmentPercentage(unit, equip));
 		}
 		
 		[Test()]
 		public void TestGetEquipmentCountsForPercentageLimitItemOnDefaultSlot()
 		{
-			UnitEquipmentItem equip = new MockPercentageAmountUnitEquipmentItem();
+			UnitEquipmentItem equip = new MockPercentageAmountUnitEquipmentItem(50);
 			UnitType unitType = equip.EquipmentForUnit;
 			Unit unit = GetUnit(unitType);
-			Assert.AreEqual(5, UnitEquipmentUtil.GetMaxEquipmentCount(unit, equip));
-			Assert.AreEqual(5, UnitEquipmentUtil.GetMinEquipmentCount(unit, equip));
+			Assert.AreEqual(7, UnitEquipmentUtil.GetMaxEquipmentCount(unit, equip));
+			Assert.AreEqual(7, UnitEquipmentUtil.GetMinEquipmentCount(unit, equip));
+			Assert.AreEqual(50, UnitEquipmentUtil.GetMaxEquipmentPercentage(unit, equip));
+		}
+		
+		[Test()]
+		public void TestGetEquipmentCountsForPercentageLimitItemOnDefaultSlotWithDifferentMinLimit()
+		{
+			UnitEquipmentItem equip = new MockPercentageAmountUnitEquipmentItem(25, 50);
+			UnitType unitType = equip.EquipmentForUnit;
+			Unit unit = GetUnit(unitType);
+			Assert.AreEqual(7, UnitEquipmentUtil.GetMaxEquipmentCount(unit, equip));
+			Assert.AreEqual(3, UnitEquipmentUtil.GetMinEquipmentCount(unit, equip));
+			Assert.AreEqual(50, UnitEquipmentUtil.GetMaxEquipmentPercentage(unit, equip));
 		}
 		
 		[Test()]
 		public void TestGetEquipmentCountsForPercentageLimitItemOnNumberLimitedSlot()
 		{
-			UnitEquipmentItem equip = new MockPercentageAmountUnitEquipmentItem();
-			equip.SlotName = "slot";
+			UnitEquipmentItem equip = new MockPercentageAmountUnitEquipmentItem(50);
+			equip.SlotName = SLOT_NAME;
 			UnitType unitType = equip.EquipmentForUnit;
-			unitType.AddEquipmentSlot("slot", new AbsoluteNumericLimit(2));
+			unitType.AddEquipmentSlot(SLOT_NAME, new AbsoluteNumericLimit(2));
 			Unit unit = GetUnit(unitType);
 			Assert.AreEqual(2, UnitEquipmentUtil.GetMaxEquipmentCount(unit, equip));
 			Assert.AreEqual(2, UnitEquipmentUtil.GetMinEquipmentCount(unit, equip));
+			Assert.AreEqual(2.0/15*100, UnitEquipmentUtil.GetMaxEquipmentPercentage(unit, equip));
+		}
+		
+		[Test()]
+		public void TestGetEquipmentCountsForPercentageLimitItemOnNumberLimitedSlotWithDifferentMinLimit()
+		{
+			UnitEquipmentItem equip = new MockPercentageAmountUnitEquipmentItem(10, 50);
+			equip.SlotName = SLOT_NAME;
+			UnitType unitType = equip.EquipmentForUnit;
+			unitType.AddEquipmentSlot(SLOT_NAME, new AbsoluteNumericLimit(2));
+			Unit unit = GetUnit(unitType);
+			Assert.AreEqual(2, UnitEquipmentUtil.GetMaxEquipmentCount(unit, equip));
+			Assert.AreEqual(1, UnitEquipmentUtil.GetMinEquipmentCount(unit, equip));
+			Assert.AreEqual(2.0/15*100, UnitEquipmentUtil.GetMaxEquipmentPercentage(unit, equip));
 		}
 		
 		[Test()]
 		public void TestGetEquipmentCountsForPercentageLimitItemOnPercentageLimitedSlot()
 		{
-			UnitEquipmentItem equip = new MockPercentageAmountUnitEquipmentItem();
-			equip.SlotName = "slot";
+			UnitEquipmentItem equip = new MockPercentageAmountUnitEquipmentItem(50);
+			equip.SlotName = SLOT_NAME;
+			UnitType unitType = equip.EquipmentForUnit;
+			unitType.AddEquipmentSlot(SLOT_NAME, new SimpleRoundedPercentageLimit(25, false));
+			Unit unit = GetUnit(unitType);
+			Assert.AreEqual(3, UnitEquipmentUtil.GetMaxEquipmentCount(unit, equip));
+			Assert.AreEqual(3, UnitEquipmentUtil.GetMinEquipmentCount(unit, equip));
+			Assert.AreEqual(25, UnitEquipmentUtil.GetMaxEquipmentPercentage(unit, equip));
+		}
+		
+		[Test()]
+		public void TestGetEquipmentCountsForPercentageLimitItemOnPercentageLimitedSlotWithDifferentMinLimit()
+		{
+			UnitEquipmentItem equip = new MockPercentageAmountUnitEquipmentItem(10, 50);
+			equip.SlotName = SLOT_NAME;
 			UnitType unitType = equip.EquipmentForUnit;
-			unitType.AddEquipmentSlot("slot", new SimpleRoundedPercentageLimit(25, false));
+			unitType.AddEquipmentSlot(SLOT_NAME, new SimpleRoundedPercentageLimit(25, false));
+			Unit unit = GetUnit(unitType);
+			Assert.AreEqual(3, UnitEquipmentUtil.GetMaxEquipmentCount(unit, equip));
+			Assert.AreEqual(1, UnitEquipmentUtil.GetMinEquipmentCount(unit, equip));
+			Assert.AreEqual(25, UnitEquipmentUtil.GetMaxEquipmentPercentage(unit, equip));
+		}
+		
+		[Test()]
+		public void TestGetEquipmentCountsForPercentageLimitItemOnPercentageLimitedSlotWithMaxBelowSlotLimit()
+		{
+			UnitEquipmentItem equip = new MockPercentageAmountUnitEquipmentItem(50);
+			equip.SlotName = SLOT_NAME;
+			UnitType unitType = equip.EquipmentForUnit;
+			unitType.AddEquipmentSlot(SLOT_NAME, new SimpleRoundedPercentageLimit(75, false));
 			Unit unit = GetUnit(unitType);
-			Assert.AreEqual(2, UnitEquipmentUtil.GetMaxEquipmentCount(unit, equip));
-			Assert.AreEqual(2, UnitEquipmentUtil.GetMinEquipmentCount(unit, equip));
+			Assert.AreEqual(7, UnitEquipmentUtil.GetMaxEquipmentCount(unit, equip));
+			Assert.AreEqual(7, UnitEquipmentUtil.GetMinEquipmentCount(unit, equip));
+			Assert.AreEqual(50, UnitEquipmentUtil.GetMaxEquipmentPercentage(unit, equip));
+		}
+		
+		[Test()]
+		public void TestGetEquipmentCountsForPercentageLimitItemOnPercentageLimitedSlotWithMaxBelowSlotLimitWithDifferentMinLimit()
+		{
+			UnitEquipmentItem equip = new MockPercentageAmountUnitEquipmentItem(25, 50);
+			equip.SlotName = SLOT_NAME;
+			UnitType unitType = equip.EquipmentForUnit;
+			unitType.AddEquipmentSlot(SLOT_NAME, new SimpleRoundedPercentageLimit(75, false));
+			Unit unit = GetUnit(unitType);
+			Assert.AreEqual(7, UnitEquipmentUtil.GetMaxEquipmentCount(unit, equip));
+			Assert.AreEqual(3, UnitEquipmentUtil.GetMinEquipmentCount(unit, equip));
+			Assert.AreEqual(50, UnitEquipmentUtil.GetMaxEquipmentPercentage(unit, equip));
 		}
 		
 		[Test()]
 		public void TestGetEquipmentCountsForPercentageLimitItemOnNumberLimitedSlotWithExistingEquipment()
 		{
-			UnitEquipmentItem equip = new MockPercentageAmountUnitEquipmentItem();
-			equip.SlotName = "slot";
+			UnitEquipmentItem equip = new MockPercentageAmountUnitEquipmentItem(50);
+			equip.SlotName = SLOT_NAME;
 			UnitType unitType = equip.EquipmentForUnit;
-			unitType.AddEquipmentSlot("slot", new AbsoluteNumericLimit(6));
+			unitType.AddEquipmentSlot(SLOT_NAME, new AbsoluteNumericLimit(7));
+			Unit unit = GetUnit(unitType);
+			UnitEquipmentItem equip2 = new MockPercentageAmountUnitEquipmentItem(new MockEquipmentItem("equip2"), unitType);
+			equip2.SlotName = SLOT_NAME;
+			unit.SetEquipmentAmount(equip2, 5);
+			Assert.AreEqual(2, UnitEquipmentUtil.GetMaxEquipmentCount(unit, equip));
+			Assert.AreEqual(2, UnitEquipmentUtil.GetMinEquipmentCount(unit, equip));
+			Assert.AreEqual(2.0/15*100, UnitEquipmentUtil.GetMaxEquipmentPercentage(unit, equip));
+		}
+		
+		[Test()]
+		public void TestGetEquipmentCountsForPercentageLimitItemOnPercentageLimitedSlotWithExistingEquipment()
+		{
+			UnitEquipmentItem equip = new MockPercentageAmountUnitEquipmentItem(50);
+			equip.SlotName = SLOT_NAME;
+			UnitType unitType = equip.EquipmentForUnit;
+			unitType.AddEquipmentSlot(SLOT_NAME, new SimpleRoundedPercentageLimit(50, true));
 			Unit unit = GetUnit(unitType);
 			UnitEquipmentItem equip2 = new MockPercentageAmountUnitEquipmentItem(new MockEquipmentItem("equip2"), unitType);
-			equip2.SlotName = "slot";
+			equip2.SlotName = SLOT_NAME;
 			unit.SetEquipmentAmount(equip2, 5);
-			Assert.AreEqual(1, UnitEquipmentUtil.GetMaxEquipmentCount(unit, equip));
+			Assert.AreEqual(3, UnitEquipmentUtil.GetMaxEquipmentCount(unit, equip));
+			Assert.AreEqual(3, UnitEquipmentUtil.GetMinEquipmentCount(unit, equip));
+			Assert.AreEqual(3.0/15*100, UnitEquipmentUtil.GetMaxEquipmentPercentage(unit, equip));
+		}
+		
+		[Test()]
+		public void TestGetEquipmentCountsForPercentageLimitItemOnPercentageLimitedSlotWithExistingEquipmentWithDifferentMinimum()
+		{
+			UnitEquipmentItem equip = new MockPercentageAmountUnitEquipmentItem(10, 50);
+			equip.SlotName = SLOT_NAME;
+			UnitType unitType = equip.EquipmentForUnit;
+			unitType.AddEquipmentSlot(SLOT_NAME, new SimpleRoundedPercentageLimit(50, true));
+			Unit unit = GetUnit(unitType);
+			UnitEquipmentItem equip2 = new MockPercentageAmountUnitEquipmentItem(new MockEquipmentItem("equip2"), unitType);
+			equip2.SlotName = SLOT_NAME;
+			unit.SetEquipmentAmount(equip2, 5);
+			Assert.AreEqual(3, UnitEquipmentUtil.GetMaxEquipmentCount(unit, equip));
 			Assert.AreEqual(1, UnitEquipmentUtil.GetMinEquipmentCount(unit, equip));
+			Assert.AreEqual(3.0/15*100, UnitEquipmentUtil.GetMaxEquipmentPercentage(unit, equip));
 		}
 		
 		[Test()]
 		public void TestIsEquipmentRatioLimitsWithRatioLimitedEquipmentAndUnlimitedSlot()
 		{
 			UnitEquipmentItem equip = new MockPercentageAmountUnitEquipmentItem();			
-			equip.SlotName = "slot";
+			equip.SlotName = SLOT_NAME;
 			UnitType unitType = equip.EquipmentForUnit;
-			unitType.AddEquipmentSlot("slot", new UnlimitedLimit());
+			unitType.AddEquipmentSlot(SLOT_NAME, new UnlimitedLimit());
 			Unit unit = GetUnit(unitType);
 			Assert.IsTrue(UnitEquipmentUtil.IsEquipmentRatioLimited(unit, equip));
 		}
@@ -139,9 +310,9 @@
 		public void TestIsEquipmentRatioLimitsWithRatioLimitedEquipmentAndRatioSlot()
 		{
 			UnitEquipmentItem equip = new MockPercentageAmountUnitEquipmentItem();
-			equip.SlotName = "slot";
+			equip.SlotName = SLOT_NAME;
 			UnitType unitType = equip.EquipmentForUnit;
-			unitType.AddEquipmentSlot("slot", new SimpleRoundedPercentageLimit(50, true));
+			unitType.AddEquipmentSlot(SLOT_NAME, new SimpleRoundedPercentageLimit(50, true));
 			Unit unit = GetUnit(unitType);
 			Assert.IsTrue(UnitEquipmentUtil.IsEquipmentRatioLimited(unit, equip));
 		}
@@ -150,9 +321,9 @@
 		public void TestIsEquipmentRatioLimitsWithRatioLimitedEquipmentAndAbsoluteSlot()
 		{
 			UnitEquipmentItem equip = new MockPercentageAmountUnitEquipmentItem();
-			equip.SlotName = "slot";
+			equip.SlotName = SLOT_NAME;
 			UnitType unitType = equip.EquipmentForUnit;
-			unitType.AddEquipmentSlot("slot", new AbsoluteNumericLimit(5));
+			unitType.AddEquipmentSlot(SLOT_NAME, new AbsoluteNumericLimit(5));
 			Unit unit = GetUnit(unitType);
 			Assert.IsFalse(UnitEquipmentUtil.IsEquipmentRatioLimited(unit, equip));
 		}
@@ -161,9 +332,9 @@
 		public void TestIsEquipmentRatioLimitsWithAbsoluteLimitedEquipmentAndAbsoluteSlot()
 		{
 			UnitEquipmentItem equip = new MockNumericAmountUnitEquipmentItem();
-			equip.SlotName = "slot";
+			equip.SlotName = SLOT_NAME;
 			UnitType unitType = equip.EquipmentForUnit;
-			unitType.AddEquipmentSlot("slot", new AbsoluteNumericLimit(5));
+			unitType.AddEquipmentSlot(SLOT_NAME, new AbsoluteNumericLimit(5));
 			Unit unit = GetUnit(unitType);
 			Assert.IsFalse(UnitEquipmentUtil.IsEquipmentRatioLimited(unit, equip));
 		}
@@ -172,9 +343,9 @@
 		public void TestIsEquipmentRatioLimitsWithAbsoluteLimitedEquipmentAndUnlimitedSlot()
 		{
 			UnitEquipmentItem equip = new MockNumericAmountUnitEquipmentItem();
-			equip.SlotName = "slot";
+			equip.SlotName = SLOT_NAME;
 			UnitType unitType = equip.EquipmentForUnit;
-			unitType.AddEquipmentSlot("slot", new UnlimitedLimit());
+			unitType.AddEquipmentSlot(SLOT_NAME, new UnlimitedLimit());
 			Unit unit = GetUnit(unitType);
 			Assert.IsFalse(UnitEquipmentUtil.IsEquipmentRatioLimited(unit, equip));
 		}
@@ -183,34 +354,16 @@
 		public void TestIsEquipmentRatioLimitsWithAbsoluteLimitedEquipmentAndRatioSlot()
 		{
 			UnitEquipmentItem equip = new MockNumericAmountUnitEquipmentItem();
-			equip.SlotName = "slot";
+			equip.SlotName = SLOT_NAME;
 			UnitType unitType = equip.EquipmentForUnit;
-			unitType.AddEquipmentSlot("slot", new SimpleRoundedPercentageLimit(50, true));
+			unitType.AddEquipmentSlot(SLOT_NAME, new SimpleRoundedPercentageLimit(50, true));
 			Unit unit = GetUnit(unitType);
 			Assert.IsFalse(UnitEquipmentUtil.IsEquipmentRatioLimited(unit, equip));
 		}
 		
-		[Test()]
-		public void TestGetMaxPercentageForPercentageLimitedEquipmentOnUnlimitedSlot()
-		{
-			UnitEquipmentItem equip = new MockPercentageAmountUnitEquipmentItem(75);
-			UnitType unitType = equip.EquipmentForUnit;
-			Unit unit = GetUnit(unitType);
-			Assert.AreEqual(75, UnitEquipmentUtil.GetMaxEquipmentPercentage(unit, equip));
-		}
-		
-		[Test()]
-		public void TestGetMaxPercentageForNumericLimitedEquipmentOnUnlimitedSlot()
-		{
-			UnitEquipmentItem equip = new MockNumericAmountUnitEquipmentItem(5);
-			UnitType unitType = equip.EquipmentForUnit;
-			Unit unit = GetUnit(unitType);
-			Assert.AreEqual(50, UnitEquipmentUtil.GetMaxEquipmentPercentage(unit, equip));
-		}
-		
 		private Unit GetUnit (UnitType unitType)
 		{
-			return new Unit ("unit", "Test Unit", 10, unitType, new MockArmyCategory (unitType.MainCategory));
+			return new Unit ("unit", "Test Unit", 15, unitType, new MockArmyCategory (unitType.MainCategory));
 		}
 	}
 }