annotate API/Util/UnitEquipmentUtilTest.cs @ 29:29e81f10bb8b

Re #208: equipmentslot limit issues * Extend unit tests to cover extra situation
author IBBoard <dev@ibboard.co.uk>
date Fri, 06 Nov 2009 20:05:29 +0000
parents 0676f6a1ee9d
children 0cc21db8d60a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
18
e8e7554fb7f3 Re #198: Add slots with count
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1 // This file (UnitEquipmentItemUtilTest.cs) is a part of the IBBoard.WarFoundry.API.Tests project and is copyright 2009 IBBoard
e8e7554fb7f3 Re #198: Add slots with count
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
2 //
e8e7554fb7f3 Re #198: Add slots with count
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
3 // The file and the library/program it is in are licensed and distributed, without warranty, under the GNU Affero GPL license, either version 3 of the License or (at your option) any later version. Please see COPYING for more information and the full license.
e8e7554fb7f3 Re #198: Add slots with count
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
4
e8e7554fb7f3 Re #198: Add slots with count
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
5 using System;
e8e7554fb7f3 Re #198: Add slots with count
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
6 using NUnit.Framework;
29
29e81f10bb8b Re #208: equipmentslot limit issues
IBBoard <dev@ibboard.co.uk>
parents: 27
diff changeset
7 using IBBoard.CustomMath;
18
e8e7554fb7f3 Re #198: Add slots with count
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
8 using IBBoard.Limits;
e8e7554fb7f3 Re #198: Add slots with count
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
9 using IBBoard.WarFoundry.API.Objects;
e8e7554fb7f3 Re #198: Add slots with count
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
10 using IBBoard.WarFoundry.API.Objects.Mock;
e8e7554fb7f3 Re #198: Add slots with count
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
11
e8e7554fb7f3 Re #198: Add slots with count
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
12 namespace IBBoard.WarFoundry.API.Util
e8e7554fb7f3 Re #198: Add slots with count
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
13 {
e8e7554fb7f3 Re #198: Add slots with count
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
14 [TestFixture()]
e8e7554fb7f3 Re #198: Add slots with count
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
15 public class UnitEquipmentUtilTest
e8e7554fb7f3 Re #198: Add slots with count
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
16 {
26
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
17 private const string SLOT_NAME = "slot";
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
18
18
e8e7554fb7f3 Re #198: Add slots with count
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
19 [Test()]
24
92db6f6a6b0b Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 23
diff changeset
20 public void TestGetEquipmentCountsForFixedLimitItemOnDefaultSlot()
18
e8e7554fb7f3 Re #198: Add slots with count
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
21 {
26
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
22 UnitEquipmentItem equip = new MockNumericAmountUnitEquipmentItem(4);
18
e8e7554fb7f3 Re #198: Add slots with count
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
23 UnitType unitType = equip.EquipmentForUnit;
19
9b23e72ba3cf Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 18
diff changeset
24 Unit unit = GetUnit (unitType);
26
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
25 Assert.AreEqual(4, UnitEquipmentUtil.GetMaxEquipmentCount(unit, equip));
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
26 Assert.AreEqual(4, UnitEquipmentUtil.GetMinEquipmentCount(unit, equip));
29
29e81f10bb8b Re #208: equipmentslot limit issues
IBBoard <dev@ibboard.co.uk>
parents: 27
diff changeset
27 Assert.AreEqual(IBBMath.Percentage(4, 15), UnitEquipmentUtil.GetMaxEquipmentPercentage(unit, equip));
29e81f10bb8b Re #208: equipmentslot limit issues
IBBoard <dev@ibboard.co.uk>
parents: 27
diff changeset
28 Assert.AreEqual(IBBMath.Percentage(4, 15), UnitEquipmentUtil.GetMinEquipmentPercentage(unit, equip));
18
e8e7554fb7f3 Re #198: Add slots with count
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
29 }
e8e7554fb7f3 Re #198: Add slots with count
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
30
e8e7554fb7f3 Re #198: Add slots with count
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
31 [Test()]
24
92db6f6a6b0b Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 23
diff changeset
32 public void TestGetEquipmentCountsForFixedLimitItemOnDefaultSlotWithDifferentMinLimit()
92db6f6a6b0b Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 23
diff changeset
33 {
26
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
34 UnitEquipmentItem equip = new MockNumericAmountUnitEquipmentItem(1,4);
24
92db6f6a6b0b Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 23
diff changeset
35 UnitType unitType = equip.EquipmentForUnit;
92db6f6a6b0b Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 23
diff changeset
36 Unit unit = GetUnit (unitType);
26
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
37 Assert.AreEqual(4, UnitEquipmentUtil.GetMaxEquipmentCount(unit, equip));
24
92db6f6a6b0b Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 23
diff changeset
38 Assert.AreEqual(1, UnitEquipmentUtil.GetMinEquipmentCount(unit, equip));
29
29e81f10bb8b Re #208: equipmentslot limit issues
IBBoard <dev@ibboard.co.uk>
parents: 27
diff changeset
39 Assert.AreEqual(IBBMath.Percentage(4, 15), UnitEquipmentUtil.GetMaxEquipmentPercentage(unit, equip));
29e81f10bb8b Re #208: equipmentslot limit issues
IBBoard <dev@ibboard.co.uk>
parents: 27
diff changeset
40 Assert.AreEqual(IBBMath.Percentage(1, 15), UnitEquipmentUtil.GetMinEquipmentPercentage(unit, equip));
24
92db6f6a6b0b Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 23
diff changeset
41 }
92db6f6a6b0b Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 23
diff changeset
42
92db6f6a6b0b Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 23
diff changeset
43 [Test()]
92db6f6a6b0b Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 23
diff changeset
44 public void TestGetEquipmentCountsForFixedLimitItemOnNumberLimitedSlot()
18
e8e7554fb7f3 Re #198: Add slots with count
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
45 {
26
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
46 UnitEquipmentItem equip = new MockNumericAmountUnitEquipmentItem(3);
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
47 equip.SlotName = SLOT_NAME;
18
e8e7554fb7f3 Re #198: Add slots with count
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
48 UnitType unitType = equip.EquipmentForUnit;
26
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
49 unitType.AddEquipmentSlot(SLOT_NAME, new AbsoluteNumericLimit(2));
19
9b23e72ba3cf Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 18
diff changeset
50 Unit unit = GetUnit(unitType);
18
e8e7554fb7f3 Re #198: Add slots with count
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
51 Assert.AreEqual(2, UnitEquipmentUtil.GetMaxEquipmentCount(unit, equip));
24
92db6f6a6b0b Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 23
diff changeset
52 Assert.AreEqual(2, UnitEquipmentUtil.GetMinEquipmentCount(unit, equip));
29
29e81f10bb8b Re #208: equipmentslot limit issues
IBBoard <dev@ibboard.co.uk>
parents: 27
diff changeset
53 Assert.AreEqual(IBBMath.Percentage(2, 15), UnitEquipmentUtil.GetMaxEquipmentPercentage(unit, equip));
29e81f10bb8b Re #208: equipmentslot limit issues
IBBoard <dev@ibboard.co.uk>
parents: 27
diff changeset
54 Assert.AreEqual(IBBMath.Percentage(2, 15), UnitEquipmentUtil.GetMinEquipmentPercentage(unit, equip));
26
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
55 }
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
56
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
57 [Test()]
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
58 public void TestGetEquipmentCountsForFixedLimitItemOnNumberLimitedSlotWithDifferentMinLimit()
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
59 {
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
60 UnitEquipmentItem equip = new MockNumericAmountUnitEquipmentItem(1, 3);
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
61 equip.SlotName = SLOT_NAME;
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
62 UnitType unitType = equip.EquipmentForUnit;
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
63 unitType.AddEquipmentSlot(SLOT_NAME, new AbsoluteNumericLimit(2));
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
64 Unit unit = GetUnit(unitType);
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
65 Assert.AreEqual(2, UnitEquipmentUtil.GetMaxEquipmentCount(unit, equip));
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
66 Assert.AreEqual(1, UnitEquipmentUtil.GetMinEquipmentCount(unit, equip));
29
29e81f10bb8b Re #208: equipmentslot limit issues
IBBoard <dev@ibboard.co.uk>
parents: 27
diff changeset
67 Assert.AreEqual(IBBMath.Percentage(2, 15), UnitEquipmentUtil.GetMaxEquipmentPercentage(unit, equip));
29e81f10bb8b Re #208: equipmentslot limit issues
IBBoard <dev@ibboard.co.uk>
parents: 27
diff changeset
68 Assert.AreEqual(IBBMath.Percentage(1, 15), UnitEquipmentUtil.GetMinEquipmentPercentage(unit, equip));
26
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
69 }
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
70
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
71 [Test()]
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
72 public void TestGetEquipmentCountsForFixedLimitItemOnNumberLimitedSlotWithMaxBelowSlotLimit()
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
73 {
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
74 UnitEquipmentItem equip = new MockNumericAmountUnitEquipmentItem(3);
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
75 equip.SlotName = SLOT_NAME;
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
76 UnitType unitType = equip.EquipmentForUnit;
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
77 unitType.AddEquipmentSlot(SLOT_NAME, new AbsoluteNumericLimit(5));
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
78 Unit unit = GetUnit(unitType);
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
79 Assert.AreEqual(3, UnitEquipmentUtil.GetMaxEquipmentCount(unit, equip));
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
80 Assert.AreEqual(3, UnitEquipmentUtil.GetMinEquipmentCount(unit, equip));
29
29e81f10bb8b Re #208: equipmentslot limit issues
IBBoard <dev@ibboard.co.uk>
parents: 27
diff changeset
81 Assert.AreEqual(IBBMath.Percentage(3, 15), UnitEquipmentUtil.GetMaxEquipmentPercentage(unit, equip));
29e81f10bb8b Re #208: equipmentslot limit issues
IBBoard <dev@ibboard.co.uk>
parents: 27
diff changeset
82 Assert.AreEqual(IBBMath.Percentage(3, 15), UnitEquipmentUtil.GetMinEquipmentPercentage(unit, equip));
18
e8e7554fb7f3 Re #198: Add slots with count
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
83 }
19
9b23e72ba3cf Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 18
diff changeset
84
9b23e72ba3cf Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 18
diff changeset
85 [Test()]
26
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
86 public void TestGetEquipmentCountsForFixedLimitItemOnNumberLimitedSlotWithMaxBelowSlotLimitWithDifferentMinLimit()
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
87 {
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
88 UnitEquipmentItem equip = new MockNumericAmountUnitEquipmentItem(1, 3);
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
89 equip.SlotName = SLOT_NAME;
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
90 UnitType unitType = equip.EquipmentForUnit;
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
91 unitType.AddEquipmentSlot(SLOT_NAME, new AbsoluteNumericLimit(5));
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
92 Unit unit = GetUnit(unitType);
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
93 Assert.AreEqual(3, UnitEquipmentUtil.GetMaxEquipmentCount(unit, equip));
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
94 Assert.AreEqual(1, UnitEquipmentUtil.GetMinEquipmentCount(unit, equip));
29
29e81f10bb8b Re #208: equipmentslot limit issues
IBBoard <dev@ibboard.co.uk>
parents: 27
diff changeset
95 Assert.AreEqual(IBBMath.Percentage(3, 15), UnitEquipmentUtil.GetMaxEquipmentPercentage(unit, equip));
29e81f10bb8b Re #208: equipmentslot limit issues
IBBoard <dev@ibboard.co.uk>
parents: 27
diff changeset
96 Assert.AreEqual(IBBMath.Percentage(1, 15), UnitEquipmentUtil.GetMinEquipmentPercentage(unit, equip));
26
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
97 }
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
98
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
99 [Test()]
24
92db6f6a6b0b Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 23
diff changeset
100 public void TestGetEquipmentCountsForFixedLimitItemOnPercentageLimitedSlot()
19
9b23e72ba3cf Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 18
diff changeset
101 {
26
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
102 UnitEquipmentItem equip = new MockNumericAmountUnitEquipmentItem(10);
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
103 equip.SlotName = SLOT_NAME;
19
9b23e72ba3cf Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 18
diff changeset
104 UnitType unitType = equip.EquipmentForUnit;
26
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
105 unitType.AddEquipmentSlot(SLOT_NAME, new SimpleRoundedPercentageLimit(50, false));
19
9b23e72ba3cf Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 18
diff changeset
106 Unit unit = GetUnit(unitType);
26
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
107 Assert.AreEqual(7, UnitEquipmentUtil.GetMaxEquipmentCount(unit, equip));
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
108 Assert.AreEqual(7, UnitEquipmentUtil.GetMinEquipmentCount(unit, equip));
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
109 Assert.AreEqual(50, UnitEquipmentUtil.GetMaxEquipmentPercentage(unit, equip));
27
0676f6a1ee9d Fixes #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
110 Assert.AreEqual(50, UnitEquipmentUtil.GetMinEquipmentPercentage(unit, equip));
26
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
111 }
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
112
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
113 [Test()]
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
114 public void TestGetEquipmentCountsForFixedLimitItemOnPercentageLimitedSlotWithDifferentMinLimit()
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
115 {
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
116 UnitEquipmentItem equip = new MockNumericAmountUnitEquipmentItem(5, 10);
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
117 equip.SlotName = SLOT_NAME;
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
118 UnitType unitType = equip.EquipmentForUnit;
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
119 unitType.AddEquipmentSlot(SLOT_NAME, new SimpleRoundedPercentageLimit(50, false));
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
120 Unit unit = GetUnit(unitType);
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
121 Assert.AreEqual(7, UnitEquipmentUtil.GetMaxEquipmentCount(unit, equip));
24
92db6f6a6b0b Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 23
diff changeset
122 Assert.AreEqual(5, UnitEquipmentUtil.GetMinEquipmentCount(unit, equip));
26
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
123 Assert.AreEqual(50, UnitEquipmentUtil.GetMaxEquipmentPercentage(unit, equip));
29
29e81f10bb8b Re #208: equipmentslot limit issues
IBBoard <dev@ibboard.co.uk>
parents: 27
diff changeset
124 Assert.AreEqual(IBBMath.Percentage(5, 15), UnitEquipmentUtil.GetMinEquipmentPercentage(unit, equip));
19
9b23e72ba3cf Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 18
diff changeset
125 }
9b23e72ba3cf Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 18
diff changeset
126
9b23e72ba3cf Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 18
diff changeset
127 [Test()]
24
92db6f6a6b0b Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 23
diff changeset
128 public void TestGetEquipmentCountsForFixedLimitItemOnNumberLimitedSlotWithExistingEquipment()
19
9b23e72ba3cf Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 18
diff changeset
129 {
26
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
130 UnitEquipmentItem equip = new MockNumericAmountUnitEquipmentItem(3);
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
131 equip.SlotName = SLOT_NAME;
19
9b23e72ba3cf Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 18
diff changeset
132 UnitType unitType = equip.EquipmentForUnit;
26
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
133 unitType.AddEquipmentSlot(SLOT_NAME, new AbsoluteNumericLimit(6));
19
9b23e72ba3cf Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 18
diff changeset
134 Unit unit =GetUnit(unitType);
9b23e72ba3cf Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 18
diff changeset
135 UnitEquipmentItem equip2 = new MockPercentageAmountUnitEquipmentItem(new MockEquipmentItem("equip2"), unitType);
26
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
136 equip2.SlotName = SLOT_NAME;
19
9b23e72ba3cf Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 18
diff changeset
137 unit.SetEquipmentAmount(equip2, 5);
9b23e72ba3cf Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 18
diff changeset
138 Assert.AreEqual(1, UnitEquipmentUtil.GetMaxEquipmentCount(unit, equip));
24
92db6f6a6b0b Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 23
diff changeset
139 Assert.AreEqual(1, UnitEquipmentUtil.GetMinEquipmentCount(unit, equip));
29
29e81f10bb8b Re #208: equipmentslot limit issues
IBBoard <dev@ibboard.co.uk>
parents: 27
diff changeset
140 Assert.AreEqual(IBBMath.Percentage(1, 15), UnitEquipmentUtil.GetMaxEquipmentPercentage(unit, equip));
29e81f10bb8b Re #208: equipmentslot limit issues
IBBoard <dev@ibboard.co.uk>
parents: 27
diff changeset
141 Assert.AreEqual(IBBMath.Percentage(1, 15), UnitEquipmentUtil.GetMinEquipmentPercentage(unit, equip));
29e81f10bb8b Re #208: equipmentslot limit issues
IBBoard <dev@ibboard.co.uk>
parents: 27
diff changeset
142 }
29e81f10bb8b Re #208: equipmentslot limit issues
IBBoard <dev@ibboard.co.uk>
parents: 27
diff changeset
143
29e81f10bb8b Re #208: equipmentslot limit issues
IBBoard <dev@ibboard.co.uk>
parents: 27
diff changeset
144 [Test()]
29e81f10bb8b Re #208: equipmentslot limit issues
IBBoard <dev@ibboard.co.uk>
parents: 27
diff changeset
145 public void TestGetEquipmentCountsForFixedLimitItemOnNumberLimitedSlotWithExistingEquipmentOfSameType()
29e81f10bb8b Re #208: equipmentslot limit issues
IBBoard <dev@ibboard.co.uk>
parents: 27
diff changeset
146 {
29e81f10bb8b Re #208: equipmentslot limit issues
IBBoard <dev@ibboard.co.uk>
parents: 27
diff changeset
147 UnitEquipmentItem equip = new MockNumericAmountUnitEquipmentItem(1, 3);
29e81f10bb8b Re #208: equipmentslot limit issues
IBBoard <dev@ibboard.co.uk>
parents: 27
diff changeset
148 equip.SlotName = SLOT_NAME;
29e81f10bb8b Re #208: equipmentslot limit issues
IBBoard <dev@ibboard.co.uk>
parents: 27
diff changeset
149 UnitType unitType = equip.EquipmentForUnit;
29e81f10bb8b Re #208: equipmentslot limit issues
IBBoard <dev@ibboard.co.uk>
parents: 27
diff changeset
150 unitType.AddEquipmentSlot(SLOT_NAME, new AbsoluteNumericLimit(3));
29e81f10bb8b Re #208: equipmentslot limit issues
IBBoard <dev@ibboard.co.uk>
parents: 27
diff changeset
151 Unit unit =GetUnit(unitType);
29e81f10bb8b Re #208: equipmentslot limit issues
IBBoard <dev@ibboard.co.uk>
parents: 27
diff changeset
152 unit.SetEquipmentAmount(equip, 2);
29e81f10bb8b Re #208: equipmentslot limit issues
IBBoard <dev@ibboard.co.uk>
parents: 27
diff changeset
153 Assert.AreEqual(3, UnitEquipmentUtil.GetMaxEquipmentCount(unit, equip));
29e81f10bb8b Re #208: equipmentslot limit issues
IBBoard <dev@ibboard.co.uk>
parents: 27
diff changeset
154 Assert.AreEqual(1, UnitEquipmentUtil.GetMinEquipmentCount(unit, equip));
29e81f10bb8b Re #208: equipmentslot limit issues
IBBoard <dev@ibboard.co.uk>
parents: 27
diff changeset
155 Assert.AreEqual(IBBMath.Percentage(3, 15), UnitEquipmentUtil.GetMaxEquipmentPercentage(unit, equip));
29e81f10bb8b Re #208: equipmentslot limit issues
IBBoard <dev@ibboard.co.uk>
parents: 27
diff changeset
156 Assert.AreEqual(IBBMath.Percentage(1, 15), UnitEquipmentUtil.GetMinEquipmentPercentage(unit, equip));
26
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
157 }
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
158
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
159 [Test()]
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
160 public void TestGetEquipmentCountsForFixedLimitItemOnNumberLimitedSlotWithExistingEquipmentDifferentMinLimit()
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
161 {
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
162 UnitEquipmentItem equip = new MockNumericAmountUnitEquipmentItem(1, 3);
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
163 equip.SlotName = SLOT_NAME;
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
164 UnitType unitType = equip.EquipmentForUnit;
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
165 unitType.AddEquipmentSlot(SLOT_NAME, new AbsoluteNumericLimit(7));
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
166 Unit unit =GetUnit(unitType);
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
167 UnitEquipmentItem equip2 = new MockPercentageAmountUnitEquipmentItem(new MockEquipmentItem("equip2"), unitType);
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
168 equip2.SlotName = SLOT_NAME;
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
169 unit.SetEquipmentAmount(equip2, 5);
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
170 Assert.AreEqual(2, UnitEquipmentUtil.GetMaxEquipmentCount(unit, equip));
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
171 Assert.AreEqual(1, UnitEquipmentUtil.GetMinEquipmentCount(unit, equip));
29
29e81f10bb8b Re #208: equipmentslot limit issues
IBBoard <dev@ibboard.co.uk>
parents: 27
diff changeset
172 Assert.AreEqual(IBBMath.Percentage(2, 15), UnitEquipmentUtil.GetMaxEquipmentPercentage(unit, equip));
29e81f10bb8b Re #208: equipmentslot limit issues
IBBoard <dev@ibboard.co.uk>
parents: 27
diff changeset
173 Assert.AreEqual(IBBMath.Percentage(1, 15), UnitEquipmentUtil.GetMinEquipmentPercentage(unit, equip));
19
9b23e72ba3cf Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 18
diff changeset
174 }
9b23e72ba3cf Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 18
diff changeset
175
9b23e72ba3cf Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 18
diff changeset
176 [Test()]
24
92db6f6a6b0b Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 23
diff changeset
177 public void TestGetEquipmentCountsForPercentageLimitItemOnDefaultSlot()
19
9b23e72ba3cf Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 18
diff changeset
178 {
26
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
179 UnitEquipmentItem equip = new MockPercentageAmountUnitEquipmentItem(50);
19
9b23e72ba3cf Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 18
diff changeset
180 UnitType unitType = equip.EquipmentForUnit;
9b23e72ba3cf Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 18
diff changeset
181 Unit unit = GetUnit(unitType);
26
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
182 Assert.AreEqual(7, UnitEquipmentUtil.GetMaxEquipmentCount(unit, equip));
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
183 Assert.AreEqual(7, UnitEquipmentUtil.GetMinEquipmentCount(unit, equip));
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
184 Assert.AreEqual(50, UnitEquipmentUtil.GetMaxEquipmentPercentage(unit, equip));
27
0676f6a1ee9d Fixes #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
185 Assert.AreEqual(50, UnitEquipmentUtil.GetMinEquipmentPercentage(unit, equip));
26
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
186 }
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
187
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
188 [Test()]
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
189 public void TestGetEquipmentCountsForPercentageLimitItemOnDefaultSlotWithDifferentMinLimit()
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
190 {
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
191 UnitEquipmentItem equip = new MockPercentageAmountUnitEquipmentItem(25, 50);
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
192 UnitType unitType = equip.EquipmentForUnit;
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
193 Unit unit = GetUnit(unitType);
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
194 Assert.AreEqual(7, UnitEquipmentUtil.GetMaxEquipmentCount(unit, equip));
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
195 Assert.AreEqual(3, UnitEquipmentUtil.GetMinEquipmentCount(unit, equip));
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
196 Assert.AreEqual(50, UnitEquipmentUtil.GetMaxEquipmentPercentage(unit, equip));
27
0676f6a1ee9d Fixes #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
197 Assert.AreEqual(25, UnitEquipmentUtil.GetMinEquipmentPercentage(unit, equip));
19
9b23e72ba3cf Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 18
diff changeset
198 }
9b23e72ba3cf Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 18
diff changeset
199
9b23e72ba3cf Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 18
diff changeset
200 [Test()]
24
92db6f6a6b0b Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 23
diff changeset
201 public void TestGetEquipmentCountsForPercentageLimitItemOnNumberLimitedSlot()
19
9b23e72ba3cf Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 18
diff changeset
202 {
26
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
203 UnitEquipmentItem equip = new MockPercentageAmountUnitEquipmentItem(50);
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
204 equip.SlotName = SLOT_NAME;
19
9b23e72ba3cf Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 18
diff changeset
205 UnitType unitType = equip.EquipmentForUnit;
26
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
206 unitType.AddEquipmentSlot(SLOT_NAME, new AbsoluteNumericLimit(2));
19
9b23e72ba3cf Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 18
diff changeset
207 Unit unit = GetUnit(unitType);
9b23e72ba3cf Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 18
diff changeset
208 Assert.AreEqual(2, UnitEquipmentUtil.GetMaxEquipmentCount(unit, equip));
24
92db6f6a6b0b Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 23
diff changeset
209 Assert.AreEqual(2, UnitEquipmentUtil.GetMinEquipmentCount(unit, equip));
29
29e81f10bb8b Re #208: equipmentslot limit issues
IBBoard <dev@ibboard.co.uk>
parents: 27
diff changeset
210 Assert.AreEqual(IBBMath.Percentage(2, 15), UnitEquipmentUtil.GetMaxEquipmentPercentage(unit, equip));
26
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
211 }
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
212
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
213 [Test()]
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
214 public void TestGetEquipmentCountsForPercentageLimitItemOnNumberLimitedSlotWithDifferentMinLimit()
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
215 {
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
216 UnitEquipmentItem equip = new MockPercentageAmountUnitEquipmentItem(10, 50);
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
217 equip.SlotName = SLOT_NAME;
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
218 UnitType unitType = equip.EquipmentForUnit;
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
219 unitType.AddEquipmentSlot(SLOT_NAME, new AbsoluteNumericLimit(2));
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
220 Unit unit = GetUnit(unitType);
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
221 Assert.AreEqual(2, UnitEquipmentUtil.GetMaxEquipmentCount(unit, equip));
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
222 Assert.AreEqual(1, UnitEquipmentUtil.GetMinEquipmentCount(unit, equip));
29
29e81f10bb8b Re #208: equipmentslot limit issues
IBBoard <dev@ibboard.co.uk>
parents: 27
diff changeset
223 Assert.AreEqual(IBBMath.Percentage(2, 15), UnitEquipmentUtil.GetMaxEquipmentPercentage(unit, equip));
29e81f10bb8b Re #208: equipmentslot limit issues
IBBoard <dev@ibboard.co.uk>
parents: 27
diff changeset
224 Assert.AreEqual(IBBMath.Percentage(1, 15), UnitEquipmentUtil.GetMinEquipmentPercentage(unit, equip));
19
9b23e72ba3cf Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 18
diff changeset
225 }
9b23e72ba3cf Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 18
diff changeset
226
9b23e72ba3cf Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 18
diff changeset
227 [Test()]
24
92db6f6a6b0b Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 23
diff changeset
228 public void TestGetEquipmentCountsForPercentageLimitItemOnPercentageLimitedSlot()
19
9b23e72ba3cf Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 18
diff changeset
229 {
26
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
230 UnitEquipmentItem equip = new MockPercentageAmountUnitEquipmentItem(50);
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
231 equip.SlotName = SLOT_NAME;
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
232 UnitType unitType = equip.EquipmentForUnit;
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
233 unitType.AddEquipmentSlot(SLOT_NAME, new SimpleRoundedPercentageLimit(25, false));
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
234 Unit unit = GetUnit(unitType);
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
235 Assert.AreEqual(3, UnitEquipmentUtil.GetMaxEquipmentCount(unit, equip));
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
236 Assert.AreEqual(3, UnitEquipmentUtil.GetMinEquipmentCount(unit, equip));
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
237 Assert.AreEqual(25, UnitEquipmentUtil.GetMaxEquipmentPercentage(unit, equip));
27
0676f6a1ee9d Fixes #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
238 Assert.AreEqual(25, UnitEquipmentUtil.GetMinEquipmentPercentage(unit, equip));
26
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
239 }
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
240
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
241 [Test()]
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
242 public void TestGetEquipmentCountsForPercentageLimitItemOnPercentageLimitedSlotWithDifferentMinLimit()
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
243 {
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
244 UnitEquipmentItem equip = new MockPercentageAmountUnitEquipmentItem(10, 50);
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
245 equip.SlotName = SLOT_NAME;
19
9b23e72ba3cf Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 18
diff changeset
246 UnitType unitType = equip.EquipmentForUnit;
26
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
247 unitType.AddEquipmentSlot(SLOT_NAME, new SimpleRoundedPercentageLimit(25, false));
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
248 Unit unit = GetUnit(unitType);
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
249 Assert.AreEqual(3, UnitEquipmentUtil.GetMaxEquipmentCount(unit, equip));
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
250 Assert.AreEqual(1, UnitEquipmentUtil.GetMinEquipmentCount(unit, equip));
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
251 Assert.AreEqual(25, UnitEquipmentUtil.GetMaxEquipmentPercentage(unit, equip));
27
0676f6a1ee9d Fixes #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
252 Assert.AreEqual(10, UnitEquipmentUtil.GetMinEquipmentPercentage(unit, equip));
26
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
253 }
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
254
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
255 [Test()]
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
256 public void TestGetEquipmentCountsForPercentageLimitItemOnPercentageLimitedSlotWithMaxBelowSlotLimit()
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
257 {
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
258 UnitEquipmentItem equip = new MockPercentageAmountUnitEquipmentItem(50);
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
259 equip.SlotName = SLOT_NAME;
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
260 UnitType unitType = equip.EquipmentForUnit;
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
261 unitType.AddEquipmentSlot(SLOT_NAME, new SimpleRoundedPercentageLimit(75, false));
19
9b23e72ba3cf Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 18
diff changeset
262 Unit unit = GetUnit(unitType);
26
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
263 Assert.AreEqual(7, UnitEquipmentUtil.GetMaxEquipmentCount(unit, equip));
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
264 Assert.AreEqual(7, UnitEquipmentUtil.GetMinEquipmentCount(unit, equip));
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
265 Assert.AreEqual(50, UnitEquipmentUtil.GetMaxEquipmentPercentage(unit, equip));
27
0676f6a1ee9d Fixes #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
266 Assert.AreEqual(50, UnitEquipmentUtil.GetMinEquipmentPercentage(unit, equip));
26
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
267 }
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
268
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
269 [Test()]
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
270 public void TestGetEquipmentCountsForPercentageLimitItemOnPercentageLimitedSlotWithMaxBelowSlotLimitWithDifferentMinLimit()
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
271 {
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
272 UnitEquipmentItem equip = new MockPercentageAmountUnitEquipmentItem(25, 50);
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
273 equip.SlotName = SLOT_NAME;
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
274 UnitType unitType = equip.EquipmentForUnit;
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
275 unitType.AddEquipmentSlot(SLOT_NAME, new SimpleRoundedPercentageLimit(75, false));
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
276 Unit unit = GetUnit(unitType);
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
277 Assert.AreEqual(7, UnitEquipmentUtil.GetMaxEquipmentCount(unit, equip));
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
278 Assert.AreEqual(3, UnitEquipmentUtil.GetMinEquipmentCount(unit, equip));
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
279 Assert.AreEqual(50, UnitEquipmentUtil.GetMaxEquipmentPercentage(unit, equip));
27
0676f6a1ee9d Fixes #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
280 Assert.AreEqual(25, UnitEquipmentUtil.GetMinEquipmentPercentage(unit, equip));
19
9b23e72ba3cf Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 18
diff changeset
281 }
9b23e72ba3cf Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 18
diff changeset
282
9b23e72ba3cf Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 18
diff changeset
283 [Test()]
24
92db6f6a6b0b Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 23
diff changeset
284 public void TestGetEquipmentCountsForPercentageLimitItemOnNumberLimitedSlotWithExistingEquipment()
19
9b23e72ba3cf Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 18
diff changeset
285 {
26
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
286 UnitEquipmentItem equip = new MockPercentageAmountUnitEquipmentItem(50);
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
287 equip.SlotName = SLOT_NAME;
19
9b23e72ba3cf Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 18
diff changeset
288 UnitType unitType = equip.EquipmentForUnit;
26
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
289 unitType.AddEquipmentSlot(SLOT_NAME, new AbsoluteNumericLimit(7));
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
290 Unit unit = GetUnit(unitType);
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
291 UnitEquipmentItem equip2 = new MockPercentageAmountUnitEquipmentItem(new MockEquipmentItem("equip2"), unitType);
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
292 equip2.SlotName = SLOT_NAME;
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
293 unit.SetEquipmentAmount(equip2, 5);
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
294 Assert.AreEqual(2, UnitEquipmentUtil.GetMaxEquipmentCount(unit, equip));
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
295 Assert.AreEqual(2, UnitEquipmentUtil.GetMinEquipmentCount(unit, equip));
29
29e81f10bb8b Re #208: equipmentslot limit issues
IBBoard <dev@ibboard.co.uk>
parents: 27
diff changeset
296 Assert.AreEqual(IBBMath.Percentage(2, 15), UnitEquipmentUtil.GetMaxEquipmentPercentage(unit, equip));
29e81f10bb8b Re #208: equipmentslot limit issues
IBBoard <dev@ibboard.co.uk>
parents: 27
diff changeset
297 Assert.AreEqual(IBBMath.Percentage(2, 15), UnitEquipmentUtil.GetMinEquipmentPercentage(unit, equip));
29e81f10bb8b Re #208: equipmentslot limit issues
IBBoard <dev@ibboard.co.uk>
parents: 27
diff changeset
298 }
29e81f10bb8b Re #208: equipmentslot limit issues
IBBoard <dev@ibboard.co.uk>
parents: 27
diff changeset
299
29e81f10bb8b Re #208: equipmentslot limit issues
IBBoard <dev@ibboard.co.uk>
parents: 27
diff changeset
300 [Test()]
29e81f10bb8b Re #208: equipmentslot limit issues
IBBoard <dev@ibboard.co.uk>
parents: 27
diff changeset
301 public void TestGetEquipmentCountsForPercentageLimitItemOnNumberLimitedSlotWithExistingEquipmentOfSameType()
29e81f10bb8b Re #208: equipmentslot limit issues
IBBoard <dev@ibboard.co.uk>
parents: 27
diff changeset
302 {
29e81f10bb8b Re #208: equipmentslot limit issues
IBBoard <dev@ibboard.co.uk>
parents: 27
diff changeset
303 UnitEquipmentItem equip = new MockPercentageAmountUnitEquipmentItem(10, 50);
29e81f10bb8b Re #208: equipmentslot limit issues
IBBoard <dev@ibboard.co.uk>
parents: 27
diff changeset
304 equip.SlotName = SLOT_NAME;
29e81f10bb8b Re #208: equipmentslot limit issues
IBBoard <dev@ibboard.co.uk>
parents: 27
diff changeset
305 UnitType unitType = equip.EquipmentForUnit;
29e81f10bb8b Re #208: equipmentslot limit issues
IBBoard <dev@ibboard.co.uk>
parents: 27
diff changeset
306 unitType.AddEquipmentSlot(SLOT_NAME, new AbsoluteNumericLimit(10));
29e81f10bb8b Re #208: equipmentslot limit issues
IBBoard <dev@ibboard.co.uk>
parents: 27
diff changeset
307 Unit unit = GetUnit(unitType);
29e81f10bb8b Re #208: equipmentslot limit issues
IBBoard <dev@ibboard.co.uk>
parents: 27
diff changeset
308 unit.SetEquipmentAmount(equip, 5);
29e81f10bb8b Re #208: equipmentslot limit issues
IBBoard <dev@ibboard.co.uk>
parents: 27
diff changeset
309 Assert.AreEqual(7, UnitEquipmentUtil.GetMaxEquipmentCount(unit, equip));
29e81f10bb8b Re #208: equipmentslot limit issues
IBBoard <dev@ibboard.co.uk>
parents: 27
diff changeset
310 Assert.AreEqual(1, UnitEquipmentUtil.GetMinEquipmentCount(unit, equip));
29e81f10bb8b Re #208: equipmentslot limit issues
IBBoard <dev@ibboard.co.uk>
parents: 27
diff changeset
311 Assert.AreEqual(50, UnitEquipmentUtil.GetMaxEquipmentPercentage(unit, equip));
29e81f10bb8b Re #208: equipmentslot limit issues
IBBoard <dev@ibboard.co.uk>
parents: 27
diff changeset
312 Assert.AreEqual(10, UnitEquipmentUtil.GetMinEquipmentPercentage(unit, equip));
26
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
313 }
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
314
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
315 [Test()]
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
316 public void TestGetEquipmentCountsForPercentageLimitItemOnPercentageLimitedSlotWithExistingEquipment()
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
317 {
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
318 UnitEquipmentItem equip = new MockPercentageAmountUnitEquipmentItem(50);
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
319 equip.SlotName = SLOT_NAME;
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
320 UnitType unitType = equip.EquipmentForUnit;
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
321 unitType.AddEquipmentSlot(SLOT_NAME, new SimpleRoundedPercentageLimit(50, true));
19
9b23e72ba3cf Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 18
diff changeset
322 Unit unit = GetUnit(unitType);
9b23e72ba3cf Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 18
diff changeset
323 UnitEquipmentItem equip2 = new MockPercentageAmountUnitEquipmentItem(new MockEquipmentItem("equip2"), unitType);
26
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
324 equip2.SlotName = SLOT_NAME;
19
9b23e72ba3cf Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 18
diff changeset
325 unit.SetEquipmentAmount(equip2, 5);
26
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
326 Assert.AreEqual(3, UnitEquipmentUtil.GetMaxEquipmentCount(unit, equip));
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
327 Assert.AreEqual(3, UnitEquipmentUtil.GetMinEquipmentCount(unit, equip));
29
29e81f10bb8b Re #208: equipmentslot limit issues
IBBoard <dev@ibboard.co.uk>
parents: 27
diff changeset
328 Assert.AreEqual(IBBMath.Percentage(3, 15), UnitEquipmentUtil.GetMaxEquipmentPercentage(unit, equip));
29e81f10bb8b Re #208: equipmentslot limit issues
IBBoard <dev@ibboard.co.uk>
parents: 27
diff changeset
329 Assert.AreEqual(IBBMath.Percentage(3, 15), UnitEquipmentUtil.GetMinEquipmentPercentage(unit, equip));
29e81f10bb8b Re #208: equipmentslot limit issues
IBBoard <dev@ibboard.co.uk>
parents: 27
diff changeset
330 }
29e81f10bb8b Re #208: equipmentslot limit issues
IBBoard <dev@ibboard.co.uk>
parents: 27
diff changeset
331
29e81f10bb8b Re #208: equipmentslot limit issues
IBBoard <dev@ibboard.co.uk>
parents: 27
diff changeset
332 [Test()]
29e81f10bb8b Re #208: equipmentslot limit issues
IBBoard <dev@ibboard.co.uk>
parents: 27
diff changeset
333 public void TestGetEquipmentCountsForPercentageLimitItemOnPercentageLimitedSlotWithExistingEquipmentOfSameType()
29e81f10bb8b Re #208: equipmentslot limit issues
IBBoard <dev@ibboard.co.uk>
parents: 27
diff changeset
334 {
29e81f10bb8b Re #208: equipmentslot limit issues
IBBoard <dev@ibboard.co.uk>
parents: 27
diff changeset
335 UnitEquipmentItem equip = new MockPercentageAmountUnitEquipmentItem(10, 50);
29e81f10bb8b Re #208: equipmentslot limit issues
IBBoard <dev@ibboard.co.uk>
parents: 27
diff changeset
336 equip.SlotName = SLOT_NAME;
29e81f10bb8b Re #208: equipmentslot limit issues
IBBoard <dev@ibboard.co.uk>
parents: 27
diff changeset
337 UnitType unitType = equip.EquipmentForUnit;
29e81f10bb8b Re #208: equipmentslot limit issues
IBBoard <dev@ibboard.co.uk>
parents: 27
diff changeset
338 unitType.AddEquipmentSlot(SLOT_NAME, new SimpleRoundedPercentageLimit(50, true));
29e81f10bb8b Re #208: equipmentslot limit issues
IBBoard <dev@ibboard.co.uk>
parents: 27
diff changeset
339 Unit unit = GetUnit(unitType);
29e81f10bb8b Re #208: equipmentslot limit issues
IBBoard <dev@ibboard.co.uk>
parents: 27
diff changeset
340 unit.SetEquipmentAmount(equip, 5);
29e81f10bb8b Re #208: equipmentslot limit issues
IBBoard <dev@ibboard.co.uk>
parents: 27
diff changeset
341 Assert.AreEqual(7, UnitEquipmentUtil.GetMaxEquipmentCount(unit, equip));
29e81f10bb8b Re #208: equipmentslot limit issues
IBBoard <dev@ibboard.co.uk>
parents: 27
diff changeset
342 Assert.AreEqual(1, UnitEquipmentUtil.GetMinEquipmentCount(unit, equip));
29e81f10bb8b Re #208: equipmentslot limit issues
IBBoard <dev@ibboard.co.uk>
parents: 27
diff changeset
343 Assert.AreEqual(50, UnitEquipmentUtil.GetMaxEquipmentPercentage(unit, equip));
29e81f10bb8b Re #208: equipmentslot limit issues
IBBoard <dev@ibboard.co.uk>
parents: 27
diff changeset
344 Assert.AreEqual(10, UnitEquipmentUtil.GetMinEquipmentPercentage(unit, equip));
26
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
345 }
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
346
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
347 [Test()]
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
348 public void TestGetEquipmentCountsForPercentageLimitItemOnPercentageLimitedSlotWithExistingEquipmentWithDifferentMinimum()
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
349 {
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
350 UnitEquipmentItem equip = new MockPercentageAmountUnitEquipmentItem(10, 50);
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
351 equip.SlotName = SLOT_NAME;
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
352 UnitType unitType = equip.EquipmentForUnit;
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
353 unitType.AddEquipmentSlot(SLOT_NAME, new SimpleRoundedPercentageLimit(50, true));
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
354 Unit unit = GetUnit(unitType);
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
355 UnitEquipmentItem equip2 = new MockPercentageAmountUnitEquipmentItem(new MockEquipmentItem("equip2"), unitType);
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
356 equip2.SlotName = SLOT_NAME;
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
357 unit.SetEquipmentAmount(equip2, 5);
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
358 Assert.AreEqual(3, UnitEquipmentUtil.GetMaxEquipmentCount(unit, equip));
21
40a2fd337907 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 19
diff changeset
359 Assert.AreEqual(1, UnitEquipmentUtil.GetMinEquipmentCount(unit, equip));
29
29e81f10bb8b Re #208: equipmentslot limit issues
IBBoard <dev@ibboard.co.uk>
parents: 27
diff changeset
360 Assert.AreEqual(IBBMath.Percentage(3, 15), UnitEquipmentUtil.GetMaxEquipmentPercentage(unit, equip));
29e81f10bb8b Re #208: equipmentslot limit issues
IBBoard <dev@ibboard.co.uk>
parents: 27
diff changeset
361 Assert.AreEqual(IBBMath.Percentage(1, 15), UnitEquipmentUtil.GetMinEquipmentPercentage(unit, equip));
21
40a2fd337907 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 19
diff changeset
362 }
22
25b21f564348 Re #198: Add equipment slot
IBBoard <dev@ibboard.co.uk>
parents: 21
diff changeset
363
25b21f564348 Re #198: Add equipment slot
IBBoard <dev@ibboard.co.uk>
parents: 21
diff changeset
364 [Test()]
25b21f564348 Re #198: Add equipment slot
IBBoard <dev@ibboard.co.uk>
parents: 21
diff changeset
365 public void TestIsEquipmentRatioLimitsWithRatioLimitedEquipmentAndUnlimitedSlot()
25b21f564348 Re #198: Add equipment slot
IBBoard <dev@ibboard.co.uk>
parents: 21
diff changeset
366 {
23
54abb61b9db8 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 22
diff changeset
367 UnitEquipmentItem equip = new MockPercentageAmountUnitEquipmentItem();
26
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
368 equip.SlotName = SLOT_NAME;
22
25b21f564348 Re #198: Add equipment slot
IBBoard <dev@ibboard.co.uk>
parents: 21
diff changeset
369 UnitType unitType = equip.EquipmentForUnit;
26
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
370 unitType.AddEquipmentSlot(SLOT_NAME, new UnlimitedLimit());
22
25b21f564348 Re #198: Add equipment slot
IBBoard <dev@ibboard.co.uk>
parents: 21
diff changeset
371 Unit unit = GetUnit(unitType);
25b21f564348 Re #198: Add equipment slot
IBBoard <dev@ibboard.co.uk>
parents: 21
diff changeset
372 Assert.IsTrue(UnitEquipmentUtil.IsEquipmentRatioLimited(unit, equip));
25b21f564348 Re #198: Add equipment slot
IBBoard <dev@ibboard.co.uk>
parents: 21
diff changeset
373 }
25b21f564348 Re #198: Add equipment slot
IBBoard <dev@ibboard.co.uk>
parents: 21
diff changeset
374
25b21f564348 Re #198: Add equipment slot
IBBoard <dev@ibboard.co.uk>
parents: 21
diff changeset
375 [Test()]
25b21f564348 Re #198: Add equipment slot
IBBoard <dev@ibboard.co.uk>
parents: 21
diff changeset
376 public void TestIsEquipmentRatioLimitsWithRatioLimitedEquipmentAndRatioSlot()
25b21f564348 Re #198: Add equipment slot
IBBoard <dev@ibboard.co.uk>
parents: 21
diff changeset
377 {
25b21f564348 Re #198: Add equipment slot
IBBoard <dev@ibboard.co.uk>
parents: 21
diff changeset
378 UnitEquipmentItem equip = new MockPercentageAmountUnitEquipmentItem();
26
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
379 equip.SlotName = SLOT_NAME;
22
25b21f564348 Re #198: Add equipment slot
IBBoard <dev@ibboard.co.uk>
parents: 21
diff changeset
380 UnitType unitType = equip.EquipmentForUnit;
26
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
381 unitType.AddEquipmentSlot(SLOT_NAME, new SimpleRoundedPercentageLimit(50, true));
22
25b21f564348 Re #198: Add equipment slot
IBBoard <dev@ibboard.co.uk>
parents: 21
diff changeset
382 Unit unit = GetUnit(unitType);
25b21f564348 Re #198: Add equipment slot
IBBoard <dev@ibboard.co.uk>
parents: 21
diff changeset
383 Assert.IsTrue(UnitEquipmentUtil.IsEquipmentRatioLimited(unit, equip));
25b21f564348 Re #198: Add equipment slot
IBBoard <dev@ibboard.co.uk>
parents: 21
diff changeset
384 }
25b21f564348 Re #198: Add equipment slot
IBBoard <dev@ibboard.co.uk>
parents: 21
diff changeset
385
25b21f564348 Re #198: Add equipment slot
IBBoard <dev@ibboard.co.uk>
parents: 21
diff changeset
386 [Test()]
25b21f564348 Re #198: Add equipment slot
IBBoard <dev@ibboard.co.uk>
parents: 21
diff changeset
387 public void TestIsEquipmentRatioLimitsWithRatioLimitedEquipmentAndAbsoluteSlot()
25b21f564348 Re #198: Add equipment slot
IBBoard <dev@ibboard.co.uk>
parents: 21
diff changeset
388 {
25b21f564348 Re #198: Add equipment slot
IBBoard <dev@ibboard.co.uk>
parents: 21
diff changeset
389 UnitEquipmentItem equip = new MockPercentageAmountUnitEquipmentItem();
26
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
390 equip.SlotName = SLOT_NAME;
22
25b21f564348 Re #198: Add equipment slot
IBBoard <dev@ibboard.co.uk>
parents: 21
diff changeset
391 UnitType unitType = equip.EquipmentForUnit;
26
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
392 unitType.AddEquipmentSlot(SLOT_NAME, new AbsoluteNumericLimit(5));
22
25b21f564348 Re #198: Add equipment slot
IBBoard <dev@ibboard.co.uk>
parents: 21
diff changeset
393 Unit unit = GetUnit(unitType);
25b21f564348 Re #198: Add equipment slot
IBBoard <dev@ibboard.co.uk>
parents: 21
diff changeset
394 Assert.IsFalse(UnitEquipmentUtil.IsEquipmentRatioLimited(unit, equip));
25b21f564348 Re #198: Add equipment slot
IBBoard <dev@ibboard.co.uk>
parents: 21
diff changeset
395 }
23
54abb61b9db8 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 22
diff changeset
396
54abb61b9db8 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 22
diff changeset
397 [Test()]
54abb61b9db8 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 22
diff changeset
398 public void TestIsEquipmentRatioLimitsWithAbsoluteLimitedEquipmentAndAbsoluteSlot()
54abb61b9db8 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 22
diff changeset
399 {
24
92db6f6a6b0b Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 23
diff changeset
400 UnitEquipmentItem equip = new MockNumericAmountUnitEquipmentItem();
26
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
401 equip.SlotName = SLOT_NAME;
23
54abb61b9db8 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 22
diff changeset
402 UnitType unitType = equip.EquipmentForUnit;
26
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
403 unitType.AddEquipmentSlot(SLOT_NAME, new AbsoluteNumericLimit(5));
23
54abb61b9db8 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 22
diff changeset
404 Unit unit = GetUnit(unitType);
54abb61b9db8 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 22
diff changeset
405 Assert.IsFalse(UnitEquipmentUtil.IsEquipmentRatioLimited(unit, equip));
54abb61b9db8 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 22
diff changeset
406 }
54abb61b9db8 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 22
diff changeset
407
54abb61b9db8 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 22
diff changeset
408 [Test()]
54abb61b9db8 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 22
diff changeset
409 public void TestIsEquipmentRatioLimitsWithAbsoluteLimitedEquipmentAndUnlimitedSlot()
54abb61b9db8 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 22
diff changeset
410 {
24
92db6f6a6b0b Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 23
diff changeset
411 UnitEquipmentItem equip = new MockNumericAmountUnitEquipmentItem();
26
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
412 equip.SlotName = SLOT_NAME;
23
54abb61b9db8 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 22
diff changeset
413 UnitType unitType = equip.EquipmentForUnit;
26
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
414 unitType.AddEquipmentSlot(SLOT_NAME, new UnlimitedLimit());
23
54abb61b9db8 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 22
diff changeset
415 Unit unit = GetUnit(unitType);
54abb61b9db8 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 22
diff changeset
416 Assert.IsFalse(UnitEquipmentUtil.IsEquipmentRatioLimited(unit, equip));
54abb61b9db8 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 22
diff changeset
417 }
54abb61b9db8 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 22
diff changeset
418
54abb61b9db8 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 22
diff changeset
419 [Test()]
54abb61b9db8 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 22
diff changeset
420 public void TestIsEquipmentRatioLimitsWithAbsoluteLimitedEquipmentAndRatioSlot()
54abb61b9db8 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 22
diff changeset
421 {
24
92db6f6a6b0b Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 23
diff changeset
422 UnitEquipmentItem equip = new MockNumericAmountUnitEquipmentItem();
26
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
423 equip.SlotName = SLOT_NAME;
23
54abb61b9db8 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 22
diff changeset
424 UnitType unitType = equip.EquipmentForUnit;
26
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
425 unitType.AddEquipmentSlot(SLOT_NAME, new SimpleRoundedPercentageLimit(50, true));
23
54abb61b9db8 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 22
diff changeset
426 Unit unit = GetUnit(unitType);
54abb61b9db8 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 22
diff changeset
427 Assert.IsFalse(UnitEquipmentUtil.IsEquipmentRatioLimited(unit, equip));
54abb61b9db8 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 22
diff changeset
428 }
24
92db6f6a6b0b Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 23
diff changeset
429
92db6f6a6b0b Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 23
diff changeset
430 private Unit GetUnit (UnitType unitType)
19
9b23e72ba3cf Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 18
diff changeset
431 {
26
e6bf9b5e1b94 Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 25
diff changeset
432 return new Unit ("unit", "Test Unit", 15, unitType, new MockArmyCategory (unitType.MainCategory));
19
9b23e72ba3cf Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 18
diff changeset
433 }
18
e8e7554fb7f3 Re #198: Add slots with count
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
434 }
e8e7554fb7f3 Re #198: Add slots with count
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
435 }