Mercurial > repos > IBDev-IBBoard.WarFoundry.API.Tests
annotate API/Objects/UnitTest.cs @ 239:370bec16a364 default tip
Add initial testing for equipment with type (incomplete)
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sun, 16 Oct 2016 20:29:35 +0100 |
parents | c026c02583ca |
children |
rev | line source |
---|---|
14
19fc7a733064
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
1 // This file (UnitTest.cs) is a part of the IBBoard.WarFoundry.API.Tests project and is copyright 2009 IBBoard |
19fc7a733064
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
2 // |
19fc7a733064
Re #198: Add slots with counts to units
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. |
19fc7a733064
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
4 |
19fc7a733064
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
5 using System; |
19fc7a733064
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
6 using NUnit.Framework; |
19fc7a733064
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
7 using IBBoard.WarFoundry.API.Objects.Mock; |
37 | 8 using IBBoard.WarFoundry.API.Util; |
19 | 9 using IBBoard.Limits; |
14
19fc7a733064
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
10 |
19fc7a733064
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
11 namespace IBBoard.WarFoundry.API.Objects |
19fc7a733064
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
12 { |
19fc7a733064
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
13 [TestFixture()] |
19fc7a733064
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
14 public class UnitTest |
15
1119b6f48e8e
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
14
diff
changeset
|
15 { |
14
19fc7a733064
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
16 [Test()] |
15
1119b6f48e8e
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
14
diff
changeset
|
17 public void TestAddNumericAmountEquipmentAddsEquipmentSelection() |
14
19fc7a733064
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
18 { |
19 | 19 UnitEquipmentItem equip = new MockNumericAmountUnitEquipmentItem(5); |
20 Assert.IsTrue(equip.MaxLimit is Limits.NumericSizeConstrainedLimit); | |
14
19fc7a733064
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
21 UnitType unitType = equip.EquipmentForUnit; |
172
c026c02583ca
* Remove MockArmy.GetMockArmy as it only causes problems in unit tests
IBBoard <dev@ibboard.co.uk>
parents:
37
diff
changeset
|
22 Unit unit = new Unit("unit", "Test Unit", 10, unitType, new ArmyCategory(new MockArmy(), unitType.MainCategory)); |
19 | 23 unit.SetEquipmentAmount(equip, 5); |
37 | 24 Assert.AreEqual(5, UnitEquipmentUtil.GetEquipmentAmount(unit, equip)); |
25 Assert.IsFalse(UnitEquipmentUtil.GetEquipmentAmountIsRatio(unit, equip)); | |
14
19fc7a733064
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
26 } |
15
1119b6f48e8e
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
14
diff
changeset
|
27 |
1119b6f48e8e
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
14
diff
changeset
|
28 [Test()] |
1119b6f48e8e
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
14
diff
changeset
|
29 public void TestRemoveNumericAmountEquipmentRemovesEquipmentSelection() |
1119b6f48e8e
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
14
diff
changeset
|
30 { |
19 | 31 UnitEquipmentItem equip = new MockNumericAmountUnitEquipmentItem(5); |
15
1119b6f48e8e
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
14
diff
changeset
|
32 UnitType unitType = equip.EquipmentForUnit; |
172
c026c02583ca
* Remove MockArmy.GetMockArmy as it only causes problems in unit tests
IBBoard <dev@ibboard.co.uk>
parents:
37
diff
changeset
|
33 Unit unit = new Unit("unit", "Test Unit", 10, unitType, new ArmyCategory(new MockArmy(), unitType.MainCategory)); |
19 | 34 unit.SetEquipmentAmount(equip, 5); |
15
1119b6f48e8e
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
14
diff
changeset
|
35 unit.SetEquipmentAmount(equip, 0); |
37 | 36 Assert.AreEqual(0, UnitEquipmentUtil.GetEquipmentAmount(unit, equip)); |
15
1119b6f48e8e
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
14
diff
changeset
|
37 } |
1119b6f48e8e
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
14
diff
changeset
|
38 |
1119b6f48e8e
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
14
diff
changeset
|
39 [Test()] |
1119b6f48e8e
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
14
diff
changeset
|
40 public void TestAddPercentageAmountEquipmentAddsEquipmentSelection() |
1119b6f48e8e
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
14
diff
changeset
|
41 { |
1119b6f48e8e
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
14
diff
changeset
|
42 UnitEquipmentItem equip = new MockPercentageAmountUnitEquipmentItem(); |
1119b6f48e8e
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
14
diff
changeset
|
43 UnitType unitType = equip.EquipmentForUnit; |
172
c026c02583ca
* Remove MockArmy.GetMockArmy as it only causes problems in unit tests
IBBoard <dev@ibboard.co.uk>
parents:
37
diff
changeset
|
44 Unit unit = new Unit("unit", "Test Unit", 10, unitType, new ArmyCategory(new MockArmy(), unitType.MainCategory)); |
15
1119b6f48e8e
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
14
diff
changeset
|
45 unit.SetEquipmentRatio(equip, 50); |
37 | 46 Assert.AreEqual(50, UnitEquipmentUtil.GetEquipmentAmount(unit, equip)); |
47 Assert.IsTrue(UnitEquipmentUtil.GetEquipmentAmountIsRatio(unit, equip)); | |
15
1119b6f48e8e
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
14
diff
changeset
|
48 } |
1119b6f48e8e
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
14
diff
changeset
|
49 |
1119b6f48e8e
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
14
diff
changeset
|
50 [Test()] |
1119b6f48e8e
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
14
diff
changeset
|
51 public void TestRemovePercentageAmountEquipmentRemovesEquipmentSelection() |
1119b6f48e8e
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
14
diff
changeset
|
52 { |
1119b6f48e8e
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
14
diff
changeset
|
53 UnitEquipmentItem equip = new MockPercentageAmountUnitEquipmentItem(); |
1119b6f48e8e
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
14
diff
changeset
|
54 UnitType unitType = equip.EquipmentForUnit; |
172
c026c02583ca
* Remove MockArmy.GetMockArmy as it only causes problems in unit tests
IBBoard <dev@ibboard.co.uk>
parents:
37
diff
changeset
|
55 Unit unit = new Unit("unit", "Test Unit", 10, unitType, new ArmyCategory(new MockArmy(), unitType.MainCategory)); |
15
1119b6f48e8e
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
14
diff
changeset
|
56 unit.SetEquipmentRatio(equip, 50); |
1119b6f48e8e
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
14
diff
changeset
|
57 unit.SetEquipmentRatio(equip, 0); |
37 | 58 Assert.AreEqual(0, UnitEquipmentUtil.GetEquipmentAmount(unit, equip)); |
15
1119b6f48e8e
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
14
diff
changeset
|
59 } |
1119b6f48e8e
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
14
diff
changeset
|
60 |
1119b6f48e8e
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
14
diff
changeset
|
61 [Test()] |
1119b6f48e8e
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
14
diff
changeset
|
62 public void TestAddNumericAmountOfPercentageAmountEquipmentAddsEquipmentSelection() |
1119b6f48e8e
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
14
diff
changeset
|
63 { |
1119b6f48e8e
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
14
diff
changeset
|
64 UnitEquipmentItem equip = new MockPercentageAmountUnitEquipmentItem(); |
1119b6f48e8e
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
14
diff
changeset
|
65 UnitType unitType = equip.EquipmentForUnit; |
172
c026c02583ca
* Remove MockArmy.GetMockArmy as it only causes problems in unit tests
IBBoard <dev@ibboard.co.uk>
parents:
37
diff
changeset
|
66 Unit unit = new Unit("unit", "Test Unit", 5, unitType, new ArmyCategory(new MockArmy(), unitType.MainCategory)); |
15
1119b6f48e8e
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
14
diff
changeset
|
67 unit.Size = 5; |
1119b6f48e8e
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
14
diff
changeset
|
68 unit.SetEquipmentAmount(equip, 2); |
37 | 69 Assert.AreEqual(2, UnitEquipmentUtil.GetEquipmentAmount(unit, equip)); |
70 Assert.IsFalse(UnitEquipmentUtil.GetEquipmentAmountIsRatio(unit, equip)); | |
15
1119b6f48e8e
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
14
diff
changeset
|
71 } |
1119b6f48e8e
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
14
diff
changeset
|
72 |
1119b6f48e8e
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
14
diff
changeset
|
73 [Test()] |
1119b6f48e8e
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
14
diff
changeset
|
74 public void TestRemoveNumericAmountOfPercentageAmountEquipmentRemovesEquipmentSelection() |
1119b6f48e8e
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
14
diff
changeset
|
75 { |
1119b6f48e8e
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
14
diff
changeset
|
76 UnitEquipmentItem equip = new MockPercentageAmountUnitEquipmentItem(); |
1119b6f48e8e
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
14
diff
changeset
|
77 UnitType unitType = equip.EquipmentForUnit; |
172
c026c02583ca
* Remove MockArmy.GetMockArmy as it only causes problems in unit tests
IBBoard <dev@ibboard.co.uk>
parents:
37
diff
changeset
|
78 Unit unit = new Unit("unit", "Test Unit", 5, unitType, new ArmyCategory(new MockArmy(), unitType.MainCategory)); |
15
1119b6f48e8e
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
14
diff
changeset
|
79 unit.SetEquipmentAmount(equip, 2); |
1119b6f48e8e
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
14
diff
changeset
|
80 unit.SetEquipmentAmount(equip, 0); |
37 | 81 Assert.AreEqual(0, UnitEquipmentUtil.GetEquipmentAmount(unit, equip)); |
15
1119b6f48e8e
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
14
diff
changeset
|
82 } |
16
74346d5c17fe
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
83 |
74346d5c17fe
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
84 [Test()] |
74346d5c17fe
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
85 public void TestAmountInSlotWithNoItems() |
74346d5c17fe
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
86 { |
74346d5c17fe
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
87 UnitType unitType = new MockUnitType(); |
172
c026c02583ca
* Remove MockArmy.GetMockArmy as it only causes problems in unit tests
IBBoard <dev@ibboard.co.uk>
parents:
37
diff
changeset
|
88 Unit unit = new Unit("unit", "Test Unit", 10, unitType, new ArmyCategory(new MockArmy(), unitType.MainCategory)); |
16
74346d5c17fe
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
89 Assert.AreEqual(0, unit.GetEquipmentAmountInSlot("")); |
74346d5c17fe
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
90 } |
74346d5c17fe
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
91 |
74346d5c17fe
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
92 [Test()] |
74346d5c17fe
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
93 public void TestAmountInSlotWithOneItem() |
74346d5c17fe
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
94 { |
74346d5c17fe
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
95 UnitEquipmentItem equip = new MockPercentageAmountUnitEquipmentItem(); |
74346d5c17fe
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
96 string slotName = "TestSlot"; |
74346d5c17fe
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
97 equip.SlotName = slotName; |
74346d5c17fe
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
98 UnitType unitType = equip.EquipmentForUnit; |
172
c026c02583ca
* Remove MockArmy.GetMockArmy as it only causes problems in unit tests
IBBoard <dev@ibboard.co.uk>
parents:
37
diff
changeset
|
99 Unit unit = new Unit("unit", "Test Unit", 5, unitType, new ArmyCategory(new MockArmy(), unitType.MainCategory)); |
16
74346d5c17fe
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
100 unit.Size = 5; |
74346d5c17fe
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
101 unit.SetEquipmentRatio(equip, 50); |
74346d5c17fe
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
102 Assert.AreEqual(2, unit.GetEquipmentAmountInSlot(slotName)); |
74346d5c17fe
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
103 } |
74346d5c17fe
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
104 |
74346d5c17fe
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
105 [Test()] |
74346d5c17fe
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
106 public void TestAmountInSlotWithMultipleItems() |
74346d5c17fe
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
107 { |
74346d5c17fe
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
108 UnitEquipmentItem equip1 = new MockPercentageAmountUnitEquipmentItem(); |
74346d5c17fe
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
109 string slotName = "TestSlot"; |
74346d5c17fe
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
110 equip1.SlotName = slotName; |
74346d5c17fe
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
111 UnitType unitType = equip1.EquipmentForUnit; |
172
c026c02583ca
* Remove MockArmy.GetMockArmy as it only causes problems in unit tests
IBBoard <dev@ibboard.co.uk>
parents:
37
diff
changeset
|
112 Unit unit = new Unit("unit", "Test Unit", 10, unitType, new ArmyCategory(new MockArmy(), unitType.MainCategory)); |
16
74346d5c17fe
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
113 unit.SetEquipmentRatio(equip1, 50); |
74346d5c17fe
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
114 UnitEquipmentItem equip2 = new MockPercentageAmountUnitEquipmentItem(new MockEquipmentItem("equip2"), unitType); |
74346d5c17fe
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
115 equip2.SlotName = slotName; |
19 | 116 equip2.MinLimit = new SimpleRoundedPercentageLimit(0); |
16
74346d5c17fe
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
117 UnitEquipmentItem equip3 = new MockPercentageAmountUnitEquipmentItem(new MockEquipmentItem("equip3"), unitType); |
74346d5c17fe
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
118 equip3.SlotName = slotName; |
19 | 119 equip3.MinLimit = new SimpleRoundedPercentageLimit(0); |
16
74346d5c17fe
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
120 unit.SetEquipmentRatio(equip2, 25); |
74346d5c17fe
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
121 unit.SetEquipmentRatio(equip3, 10); |
74346d5c17fe
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
122 Assert.AreEqual(8, unit.GetEquipmentAmountInSlot(slotName)); |
74346d5c17fe
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
15
diff
changeset
|
123 } |
17 | 124 |
125 [Test()] | |
126 public void TestAmountInSlotWithOneItemAfterRemove() | |
127 { | |
128 UnitEquipmentItem equip = new MockPercentageAmountUnitEquipmentItem(); | |
129 string slotName = "TestSlot"; | |
130 equip.SlotName = slotName; | |
131 UnitType unitType = equip.EquipmentForUnit; | |
172
c026c02583ca
* Remove MockArmy.GetMockArmy as it only causes problems in unit tests
IBBoard <dev@ibboard.co.uk>
parents:
37
diff
changeset
|
132 Unit unit = new Unit("unit", "Test Unit", 5, unitType, new ArmyCategory(new MockArmy(), unitType.MainCategory)); |
17 | 133 unit.SetEquipmentRatio(equip, 50); |
134 unit.SetEquipmentRatio(equip, 0); | |
135 Assert.AreEqual(0, unit.GetEquipmentAmountInSlot(slotName)); | |
136 } | |
137 | |
138 [Test()] | |
139 public void TestAmountInSlotWithMultipleItemsAfterRemove() | |
140 { | |
141 UnitEquipmentItem equip1 = new MockPercentageAmountUnitEquipmentItem(); | |
142 string slotName = "TestSlot"; | |
143 equip1.SlotName = slotName; | |
144 UnitType unitType = equip1.EquipmentForUnit; | |
172
c026c02583ca
* Remove MockArmy.GetMockArmy as it only causes problems in unit tests
IBBoard <dev@ibboard.co.uk>
parents:
37
diff
changeset
|
145 Unit unit = new Unit("unit", "Test Unit", 10, unitType, new ArmyCategory(new MockArmy(), unitType.MainCategory)); |
17 | 146 unit.SetEquipmentRatio(equip1, 50); |
147 UnitEquipmentItem equip2 = new MockPercentageAmountUnitEquipmentItem(new MockEquipmentItem("equip2"), unitType); | |
148 equip2.SlotName = slotName; | |
19 | 149 equip2.MinLimit = new SimpleRoundedPercentageLimit(0); |
17 | 150 UnitEquipmentItem equip3 = new MockPercentageAmountUnitEquipmentItem(new MockEquipmentItem("equip3"), unitType); |
151 equip3.SlotName = slotName; | |
19 | 152 equip3.MinLimit = new SimpleRoundedPercentageLimit(0); |
17 | 153 unit.SetEquipmentRatio(equip2, 25); |
154 unit.SetEquipmentRatio(equip3, 10); | |
155 unit.SetEquipmentAmount(equip1, 0); | |
156 Assert.AreEqual(3, unit.GetEquipmentAmountInSlot(slotName)); | |
157 } | |
14
19fc7a733064
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
158 } |
19fc7a733064
Re #198: Add slots with counts to units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
159 } |