Mercurial > repos > IBBoard.WarFoundry.API.Tests
comparison API/Objects/Requirement/RequiresNUnitsForMUnitsRequirementTest.cs @ 207:27f163bf884a
Re #379: Fix validation of requirements to check for unit
* Update checked text to match new, cleaner text
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Tue, 31 Jan 2012 20:59:15 +0000 |
parents | 49e50238c380 |
children |
comparison
equal
deleted
inserted
replaced
206:78ba834cb1f7 | 207:27f163bf884a |
---|---|
60 { | 60 { |
61 Army army = new Army(mockRace, "Test", 1000); | 61 Army army = new Army(mockRace, "Test", 1000); |
62 RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1, unitType2); | 62 RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1, unitType2); |
63 Unit unit = CreateUnitOfType(unitType1, army); | 63 Unit unit = CreateUnitOfType(unitType1, army); |
64 Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed)); | 64 Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed)); |
65 Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 1 "+unitType2.Name+" for every 1 "+unitType1.Name + " (would have 0 for 1).")); | 65 Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " for every 1 × " + unitType1.Name + " (would have 0 for 1).")); |
66 } | 66 } |
67 | 67 |
68 [Test()] | 68 [Test()] |
69 public void TestAddingOneUnitWithTwoDifferentUnitTypesRequiredAndNoUnitOfOneTypeFails() | 69 public void TestAddingOneUnitWithTwoDifferentUnitTypesRequiredAndNoUnitOfOneTypeFails() |
70 { | 70 { |
73 RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1); | 73 RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1); |
74 req.AddUnitTypeRequirement(unitType2); | 74 req.AddUnitTypeRequirement(unitType2); |
75 req.AddUnitTypeRequirement(unitType3); | 75 req.AddUnitTypeRequirement(unitType3); |
76 Unit unit = CreateUnitOfType(unitType1, army); | 76 Unit unit = CreateUnitOfType(unitType1, army); |
77 Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed)); | 77 Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed)); |
78 Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 1 " + unitType3.Name + " for every 1 " + unitType1.Name + " (would have 0 for 1).")); | 78 Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 1 × " + unitType3.Name + " for every 1 × " + unitType1.Name + " (would have 0 for 1).")); |
79 } | 79 } |
80 | 80 |
81 [Test()] | 81 [Test()] |
82 public void TestAddingTwoUnitsWithOneUnitTypeRequiredAndOneUnitOfTypeFails() | 82 public void TestAddingTwoUnitsWithOneUnitTypeRequiredAndOneUnitOfTypeFails() |
83 { | 83 { |
85 AddUnitOfTypeToArmy(unitType2, army); | 85 AddUnitOfTypeToArmy(unitType2, army); |
86 AddUnitOfTypeToArmy(unitType1, army); | 86 AddUnitOfTypeToArmy(unitType1, army); |
87 RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1, unitType2); | 87 RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1, unitType2); |
88 Unit unit = CreateUnitOfType(unitType1, army); | 88 Unit unit = CreateUnitOfType(unitType1, army); |
89 Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed)); | 89 Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed)); |
90 Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 1 " + unitType2.Name + " for every 1 " + unitType1.Name + " (would have 1 for 2).")); | 90 Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " for every 1 × " + unitType1.Name + " (would have 1 for 2).")); |
91 } | 91 } |
92 | 92 |
93 [Test()] | 93 [Test()] |
94 public void TestAddingTwoUnitsWithTwoOfUnitTypeAllowedForOneUnitTypeRequiredAndOneUnitOfTypePasses() | 94 public void TestAddingTwoUnitsWithTwoOfUnitTypeAllowedForOneUnitTypeRequiredAndOneUnitOfTypePasses() |
95 { | 95 { |
113 RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1); | 113 RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1); |
114 req.AddUnitTypeRequirement(unitType2, 1, 2); | 114 req.AddUnitTypeRequirement(unitType2, 1, 2); |
115 req.AddUnitTypeRequirement(unitType3, 1, 1); | 115 req.AddUnitTypeRequirement(unitType3, 1, 1); |
116 Unit unit = CreateUnitOfType(unitType1, army); | 116 Unit unit = CreateUnitOfType(unitType1, army); |
117 Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed)); | 117 Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed)); |
118 Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 1 " + unitType3.Name + " for every 1 " + unitType1.Name + " (would have 1 for 2).")); | 118 Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 1 × " + unitType3.Name + " for every 1 × " + unitType1.Name + " (would have 1 for 2).")); |
119 } | 119 } |
120 | 120 |
121 [Test()] | 121 [Test()] |
122 public void TestAddingSecondUnitsWithOneAllowedForTwoTypesFails() | 122 public void TestAddingSecondUnitsWithOneAllowedForTwoTypesFails() |
123 { | 123 { |
128 RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1); | 128 RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1); |
129 req.AddUnitTypeRequirement(unitType2, 1, 1); | 129 req.AddUnitTypeRequirement(unitType2, 1, 1); |
130 req.AddUnitTypeRequirement(unitType3, 1, 1); | 130 req.AddUnitTypeRequirement(unitType3, 1, 1); |
131 Unit unit = CreateUnitOfType(unitType1, army); | 131 Unit unit = CreateUnitOfType(unitType1, army); |
132 Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed)); | 132 Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed)); |
133 Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 1 " + unitType2.Name + " for every 1 " + unitType1.Name + " (would have 1 for 2); 1 " + unitType3.Name + " for every 1 " + unitType1.Name + " (would have 1 for 2).")); | 133 Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " for every 1 × " + unitType1.Name + " (would have 1 for 2); 1 × " + unitType3.Name + " for every 1 × " + unitType1.Name + " (would have 1 for 2).")); |
134 } | 134 } |
135 | 135 |
136 [Test()] | 136 [Test()] |
137 public void TestAddingSecondUnitsWithOneAllowedForTwoTypesFails_ShorthandMethod() | 137 public void TestAddingSecondUnitsWithOneAllowedForTwoTypesFails_ShorthandMethod() |
138 { | 138 { |
141 AddUnitOfTypeToArmy(unitType3, army); | 141 AddUnitOfTypeToArmy(unitType3, army); |
142 AddUnitOfTypeToArmy(unitType1, army); | 142 AddUnitOfTypeToArmy(unitType1, army); |
143 RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1, unitType2, unitType3); | 143 RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1, unitType2, unitType3); |
144 Unit unit = CreateUnitOfType(unitType1, army); | 144 Unit unit = CreateUnitOfType(unitType1, army); |
145 Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed)); | 145 Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed)); |
146 Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 1 " + unitType2.Name + " for every 1 " + unitType1.Name + " (would have 1 for 2); 1 " + unitType3.Name + " for every 1 " + unitType1.Name + " (would have 1 for 2).")); | 146 Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " for every 1 × " + unitType1.Name + " (would have 1 for 2); 1 × " + unitType3.Name + " for every 1 × " + unitType1.Name + " (would have 1 for 2).")); |
147 } | 147 } |
148 | 148 |
149 [Test()] | 149 [Test()] |
150 public void TestAddingThreeUnitsWithTwoOfUnitTypeAllowedForOneUnitTypeRequiredAndOneUnitOfTypeFails() | 150 public void TestAddingThreeUnitsWithTwoOfUnitTypeAllowedForOneUnitTypeRequiredAndOneUnitOfTypeFails() |
151 { | 151 { |
155 AddUnitOfTypeToArmy(unitType1, army); | 155 AddUnitOfTypeToArmy(unitType1, army); |
156 RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1); | 156 RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1); |
157 req.AddUnitTypeRequirement(unitType2, 1, 2); | 157 req.AddUnitTypeRequirement(unitType2, 1, 2); |
158 Unit unit = CreateUnitOfType(unitType1, army); | 158 Unit unit = CreateUnitOfType(unitType1, army); |
159 Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed)); | 159 Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed)); |
160 Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 1 " + unitType2.Name + " for every 2 " + unitType1.Name + " (would have 1 for 3).")); | 160 Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " for every 2 × " + unitType1.Name + " (would have 1 for 3).")); |
161 } | 161 } |
162 | 162 |
163 [Test()] | 163 [Test()] |
164 public void TestAddingOneUnitWithThreeOfUnitTypeAllowedForTwoOfUnitTypeRequiredAndOneUnitOfTypeFails() | 164 public void TestAddingOneUnitWithThreeOfUnitTypeAllowedForTwoOfUnitTypeRequiredAndOneUnitOfTypeFails() |
165 { | 165 { |
167 AddUnitOfTypeToArmy(unitType2, army); | 167 AddUnitOfTypeToArmy(unitType2, army); |
168 RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1); | 168 RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1); |
169 req.AddUnitTypeRequirement(unitType2, 2, 3); | 169 req.AddUnitTypeRequirement(unitType2, 2, 3); |
170 Unit unit = CreateUnitOfType(unitType1, army); | 170 Unit unit = CreateUnitOfType(unitType1, army); |
171 Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed)); | 171 Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed)); |
172 Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 2 " + unitType2.Name + " for every 3 " + unitType1.Name + " (would have 1 for 1).")); | 172 Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 2 × " + unitType2.Name + " for every 3 × " + unitType1.Name + " (would have 1 for 1).")); |
173 } | 173 } |
174 | 174 |
175 [Test()] | 175 [Test()] |
176 public void TestAddingSecondUnitWithThreeOfUnitTypeAllowedForTwoOfUnitTypeRequiredAndOneUnitOfTypeFails() | 176 public void TestAddingSecondUnitWithThreeOfUnitTypeAllowedForTwoOfUnitTypeRequiredAndOneUnitOfTypeFails() |
177 { | 177 { |
180 AddUnitOfTypeToArmy(unitType1, army); | 180 AddUnitOfTypeToArmy(unitType1, army); |
181 RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1); | 181 RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1); |
182 req.AddUnitTypeRequirement(unitType2, 2, 3); | 182 req.AddUnitTypeRequirement(unitType2, 2, 3); |
183 Unit unit = CreateUnitOfType(unitType1, army); | 183 Unit unit = CreateUnitOfType(unitType1, army); |
184 Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed)); | 184 Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed)); |
185 Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 2 " + unitType2.Name + " for every 3 " + unitType1.Name + " (would have 1 for 2).")); | 185 Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 2 × " + unitType2.Name + " for every 3 × " + unitType1.Name + " (would have 1 for 2).")); |
186 } | 186 } |
187 | 187 |
188 [Test()] | 188 [Test()] |
189 public void TestAddingFourthUnitWithThreeOfUnitTypeAllowedForTwoOfUnitTypeRequiredAndThreeUnitsOfTypeFails() | 189 public void TestAddingFourthUnitWithThreeOfUnitTypeAllowedForTwoOfUnitTypeRequiredAndThreeUnitsOfTypeFails() |
190 { | 190 { |
193 AddUnitsOfTypeToArmy(3, unitType1, army); | 193 AddUnitsOfTypeToArmy(3, unitType1, army); |
194 RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1); | 194 RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1); |
195 req.AddUnitTypeRequirement(unitType2, 2, 3); | 195 req.AddUnitTypeRequirement(unitType2, 2, 3); |
196 Unit unit = CreateUnitOfType(unitType1, army); | 196 Unit unit = CreateUnitOfType(unitType1, army); |
197 Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed)); | 197 Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed)); |
198 Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 2 " + unitType2.Name + " for every 3 " + unitType1.Name + " (would have 3 for 4).")); | 198 Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 2 × " + unitType2.Name + " for every 3 × " + unitType1.Name + " (would have 3 for 4).")); |
199 } | 199 } |
200 | 200 |
201 [Test()] | 201 [Test()] |
202 public void TestAddingUnrelatedUnitWithNoUnitsAndTwoCombinedUnitTypesRequiredIsNA() | 202 public void TestAddingUnrelatedUnitWithNoUnitsAndTwoCombinedUnitTypesRequiredIsNA() |
203 { | 203 { |
285 AddUnitOfTypeToArmy(unitType1, army); | 285 AddUnitOfTypeToArmy(unitType1, army); |
286 RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1); | 286 RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1); |
287 req.AddUnitTypeRequirement(unitType2, unitType3); | 287 req.AddUnitTypeRequirement(unitType2, unitType3); |
288 Unit unit = CreateUnitOfType(unitType1, army); | 288 Unit unit = CreateUnitOfType(unitType1, army); |
289 Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed)); | 289 Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed)); |
290 Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 1 " + unitType2.Name + " or " + unitType3.Name + " for every 1 " + unitType1.Name + " (would have 2 for 3).")); | 290 Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " or " + unitType3.Name + " for every 1 × " + unitType1.Name + " (would have 2 for 3).")); |
291 } | 291 } |
292 | 292 |
293 [Test()] | 293 [Test()] |
294 public void TestAddingThreeUnitsWithTwoUnitTypeComboRequiredAndTwoUnitsOfOneTypeFails() | 294 public void TestAddingThreeUnitsWithTwoUnitTypeComboRequiredAndTwoUnitsOfOneTypeFails() |
295 { | 295 { |
300 AddUnitOfTypeToArmy(unitType1, army); | 300 AddUnitOfTypeToArmy(unitType1, army); |
301 RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1); | 301 RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1); |
302 req.AddUnitTypeRequirement(unitType2, unitType3); | 302 req.AddUnitTypeRequirement(unitType2, unitType3); |
303 Unit unit = CreateUnitOfType(unitType1, army); | 303 Unit unit = CreateUnitOfType(unitType1, army); |
304 Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed)); | 304 Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed)); |
305 Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 1 " + unitType2.Name + " or " + unitType3.Name + " for every 1 " + unitType1.Name + " (would have 2 for 3).")); | 305 Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " or " + unitType3.Name + " for every 1 × " + unitType1.Name + " (would have 2 for 3).")); |
306 } | 306 } |
307 | 307 |
308 [Test()] | 308 [Test()] |
309 public void TestAddingThreeUnitsWithTwoUnitTypeComboRequiredAndTwoUnitsOfOtherTypeFails() | 309 public void TestAddingThreeUnitsWithTwoUnitTypeComboRequiredAndTwoUnitsOfOtherTypeFails() |
310 { | 310 { |
315 AddUnitOfTypeToArmy(unitType1, army); | 315 AddUnitOfTypeToArmy(unitType1, army); |
316 RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1); | 316 RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1); |
317 req.AddUnitTypeRequirement(unitType2, unitType3); | 317 req.AddUnitTypeRequirement(unitType2, unitType3); |
318 Unit unit = CreateUnitOfType(unitType1, army); | 318 Unit unit = CreateUnitOfType(unitType1, army); |
319 Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed)); | 319 Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed)); |
320 Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 1 " + unitType2.Name + " or " + unitType3.Name + " for every 1 " + unitType1.Name + " (would have 2 for 3).")); | 320 Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " or " + unitType3.Name + " for every 1 × " + unitType1.Name + " (would have 2 for 3).")); |
321 } | 321 } |
322 | 322 |
323 [Test()] | 323 [Test()] |
324 public void TestAddingUnrelatedUnitWithNoUnitsAndThreeForEachTwoCombinedUnitTypesRequiredIsNA() | 324 public void TestAddingUnrelatedUnitWithNoUnitsAndThreeForEachTwoCombinedUnitTypesRequiredIsNA() |
325 { | 325 { |
406 AddUnitsOfTypeToArmy(6, unitType1, army); | 406 AddUnitsOfTypeToArmy(6, unitType1, army); |
407 RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1); | 407 RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1); |
408 req.AddUnitTypeRequirement(3, unitType2, unitType3); | 408 req.AddUnitTypeRequirement(3, unitType2, unitType3); |
409 Unit unit = CreateUnitOfType(unitType1, army); | 409 Unit unit = CreateUnitOfType(unitType1, army); |
410 Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed)); | 410 Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed)); |
411 Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 1 " + unitType2.Name + " or " + unitType3.Name + " for every 3 " + unitType1.Name + " (would have 2 for 7).")); | 411 Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " or " + unitType3.Name + " for every 3 × " + unitType1.Name + " (would have 2 for 7).")); |
412 } | 412 } |
413 | 413 |
414 [Test()] | 414 [Test()] |
415 public void TestAddingSevenUnitsWithThreeForEachTwoUnitTypeComboRequiredAndTwoUnitsOfOneTypeFails() | 415 public void TestAddingSevenUnitsWithThreeForEachTwoUnitTypeComboRequiredAndTwoUnitsOfOneTypeFails() |
416 { | 416 { |
419 AddUnitsOfTypeToArmy(6, unitType1, army); | 419 AddUnitsOfTypeToArmy(6, unitType1, army); |
420 RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1); | 420 RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1); |
421 req.AddUnitTypeRequirement(3, unitType2, unitType3); | 421 req.AddUnitTypeRequirement(3, unitType2, unitType3); |
422 Unit unit = CreateUnitOfType(unitType1, army); | 422 Unit unit = CreateUnitOfType(unitType1, army); |
423 Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed)); | 423 Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed)); |
424 Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 1 " + unitType2.Name + " or " + unitType3.Name + " for every 3 " + unitType1.Name + " (would have 2 for 7).")); | 424 Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " or " + unitType3.Name + " for every 3 × " + unitType1.Name + " (would have 2 for 7).")); |
425 } | 425 } |
426 | 426 |
427 [Test()] | 427 [Test()] |
428 public void TestAddingSevenUnitsWithThreeForEachTwoUnitTypeComboRequiredAndTwoUnitsOfOtherTypeFails() | 428 public void TestAddingSevenUnitsWithThreeForEachTwoUnitTypeComboRequiredAndTwoUnitsOfOtherTypeFails() |
429 { | 429 { |
432 AddUnitsOfTypeToArmy(6, unitType1, army); | 432 AddUnitsOfTypeToArmy(6, unitType1, army); |
433 RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1); | 433 RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1); |
434 req.AddUnitTypeRequirement(3, unitType2, unitType3); | 434 req.AddUnitTypeRequirement(3, unitType2, unitType3); |
435 Unit unit = CreateUnitOfType(unitType1, army); | 435 Unit unit = CreateUnitOfType(unitType1, army); |
436 Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed)); | 436 Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed)); |
437 Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 1 " + unitType2.Name + " or " + unitType3.Name + " for every 3 " + unitType1.Name + " (would have 2 for 7).")); | 437 Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " or " + unitType3.Name + " for every 3 × " + unitType1.Name + " (would have 2 for 7).")); |
438 } | 438 } |
439 | 439 |
440 [Test()] | 440 [Test()] |
441 public void TestValidatingArmyWithNoUnitsAndOneUnitTypeRequiredIsNA() | 441 public void TestValidatingArmyWithNoUnitsAndOneUnitTypeRequiredIsNA() |
442 { | 442 { |
462 { | 462 { |
463 Army army = new Army(mockRace, "Test", 1000); | 463 Army army = new Army(mockRace, "Test", 1000); |
464 AddUnitOfTypeToArmy(unitType1, army); | 464 AddUnitOfTypeToArmy(unitType1, army); |
465 RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1, unitType2); | 465 RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1, unitType2); |
466 Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Failed)); | 466 Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Failed)); |
467 Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 1 " + unitType2.Name + " for every 1 " + unitType1.Name + " (have 0 for 1).")); | 467 Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " for every 1 × " + unitType1.Name + " (have 0 for 1).")); |
468 } | 468 } |
469 | 469 |
470 [Test()] | 470 [Test()] |
471 public void TestValidatingArmyWithTwoDifferentUnitTypesRequiredAndNoUnitOfOneTypeFails() | 471 public void TestValidatingArmyWithTwoDifferentUnitTypesRequiredAndNoUnitOfOneTypeFails() |
472 { | 472 { |
475 AddUnitOfTypeToArmy(unitType1, army); | 475 AddUnitOfTypeToArmy(unitType1, army); |
476 RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1); | 476 RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1); |
477 req.AddUnitTypeRequirement(unitType2); | 477 req.AddUnitTypeRequirement(unitType2); |
478 req.AddUnitTypeRequirement(unitType3); | 478 req.AddUnitTypeRequirement(unitType3); |
479 Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Failed)); | 479 Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Failed)); |
480 Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 1 " + unitType3.Name + " for every 1 " + unitType1.Name + " (have 0 for 1).")); | 480 Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 1 × " + unitType3.Name + " for every 1 × " + unitType1.Name + " (have 0 for 1).")); |
481 } | 481 } |
482 | 482 |
483 [Test()] | 483 [Test()] |
484 public void TestValidatingArmyWithTwoUnitsAndOneUnitTypeRequiredAndOneUnitOfTypeFails() | 484 public void TestValidatingArmyWithTwoUnitsAndOneUnitTypeRequiredAndOneUnitOfTypeFails() |
485 { | 485 { |
487 AddUnitOfTypeToArmy(unitType2, army); | 487 AddUnitOfTypeToArmy(unitType2, army); |
488 AddUnitOfTypeToArmy(unitType1, army); | 488 AddUnitOfTypeToArmy(unitType1, army); |
489 AddUnitOfTypeToArmy(unitType1, army); | 489 AddUnitOfTypeToArmy(unitType1, army); |
490 RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1, unitType2); | 490 RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1, unitType2); |
491 Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Failed)); | 491 Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Failed)); |
492 Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 1 " + unitType2.Name + " for every 1 " + unitType1.Name + " (have 1 for 2).")); | 492 Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " for every 1 × " + unitType1.Name + " (have 1 for 2).")); |
493 } | 493 } |
494 | 494 |
495 [Test()] | 495 [Test()] |
496 public void TestValidatingArmyWithTwoUnitsAndTwoOfUnitTypeAllowedForOneUnitTypeRequiredAndOneUnitOfTypePasses() | 496 public void TestValidatingArmyWithTwoUnitsAndTwoOfUnitTypeAllowedForOneUnitTypeRequiredAndOneUnitOfTypePasses() |
497 { | 497 { |
515 AddUnitOfTypeToArmy(unitType1, army); | 515 AddUnitOfTypeToArmy(unitType1, army); |
516 RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1); | 516 RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1); |
517 req.AddUnitTypeRequirement(unitType2, 1, 2); | 517 req.AddUnitTypeRequirement(unitType2, 1, 2); |
518 req.AddUnitTypeRequirement(unitType3, 1, 1); | 518 req.AddUnitTypeRequirement(unitType3, 1, 1); |
519 Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Failed)); | 519 Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Failed)); |
520 Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 1 " + unitType3.Name + " for every 1 " + unitType1.Name + " (have 1 for 2).")); | 520 Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 1 × " + unitType3.Name + " for every 1 × " + unitType1.Name + " (have 1 for 2).")); |
521 } | 521 } |
522 | 522 |
523 [Test()] | 523 [Test()] |
524 public void TestValidatingArmyWithTwoUnitsWithOneAllowedForTwoTypesFails() | 524 public void TestValidatingArmyWithTwoUnitsWithOneAllowedForTwoTypesFails() |
525 { | 525 { |
530 AddUnitOfTypeToArmy(unitType1, army); | 530 AddUnitOfTypeToArmy(unitType1, army); |
531 RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1); | 531 RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1); |
532 req.AddUnitTypeRequirement(unitType2, 1, 1); | 532 req.AddUnitTypeRequirement(unitType2, 1, 1); |
533 req.AddUnitTypeRequirement(unitType3, 1, 1); | 533 req.AddUnitTypeRequirement(unitType3, 1, 1); |
534 Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Failed)); | 534 Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Failed)); |
535 Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 1 " + unitType2.Name + " for every 1 " + unitType1.Name + " (have 1 for 2); 1 " + unitType3.Name + " for every 1 " + unitType1.Name + " (have 1 for 2).")); | 535 Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " for every 1 × " + unitType1.Name + " (have 1 for 2); 1 × " + unitType3.Name + " for every 1 × " + unitType1.Name + " (have 1 for 2).")); |
536 } | 536 } |
537 | 537 |
538 [Test()] | 538 [Test()] |
539 public void TestValidatingArmyWithTwoUnitsWithOneAllowedForTwoTypesFails_ShorthandMethod() | 539 public void TestValidatingArmyWithTwoUnitsWithOneAllowedForTwoTypesFails_ShorthandMethod() |
540 { | 540 { |
543 AddUnitOfTypeToArmy(unitType3, army); | 543 AddUnitOfTypeToArmy(unitType3, army); |
544 AddUnitOfTypeToArmy(unitType1, army); | 544 AddUnitOfTypeToArmy(unitType1, army); |
545 AddUnitOfTypeToArmy(unitType1, army); | 545 AddUnitOfTypeToArmy(unitType1, army); |
546 RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1, unitType2, unitType3); | 546 RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1, unitType2, unitType3); |
547 Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Failed)); | 547 Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Failed)); |
548 Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 1 " + unitType2.Name + " for every 1 " + unitType1.Name + " (have 1 for 2); 1 " + unitType3.Name + " for every 1 " + unitType1.Name + " (have 1 for 2).")); | 548 Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " for every 1 × " + unitType1.Name + " (have 1 for 2); 1 × " + unitType3.Name + " for every 1 × " + unitType1.Name + " (have 1 for 2).")); |
549 } | 549 } |
550 | 550 |
551 [Test()] | 551 [Test()] |
552 public void TestValidatingArmyWithOneUnitWithThreeOfUnitTypeAllowedForTwoOfUnitTypeRequiredAndOneUnitOfTypeFails() | 552 public void TestValidatingArmyWithOneUnitWithThreeOfUnitTypeAllowedForTwoOfUnitTypeRequiredAndOneUnitOfTypeFails() |
553 { | 553 { |
555 AddUnitOfTypeToArmy(unitType2, army); | 555 AddUnitOfTypeToArmy(unitType2, army); |
556 AddUnitOfTypeToArmy(unitType1, army); | 556 AddUnitOfTypeToArmy(unitType1, army); |
557 RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1); | 557 RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1); |
558 req.AddUnitTypeRequirement(unitType2, 2, 3); | 558 req.AddUnitTypeRequirement(unitType2, 2, 3); |
559 Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Failed)); | 559 Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Failed)); |
560 Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 2 " + unitType2.Name + " for every 3 " + unitType1.Name + " (have 1 for 1).")); | 560 Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 2 × " + unitType2.Name + " for every 3 × " + unitType1.Name + " (have 1 for 1).")); |
561 } | 561 } |
562 | 562 |
563 [Test()] | 563 [Test()] |
564 public void TestValidatingArmyWithTwoUnitsWithThreeOfUnitTypeAllowedForTwoOfUnitTypeRequiredAndOneUnitOfTypeFails() | 564 public void TestValidatingArmyWithTwoUnitsWithThreeOfUnitTypeAllowedForTwoOfUnitTypeRequiredAndOneUnitOfTypeFails() |
565 { | 565 { |
567 AddUnitOfTypeToArmy(unitType2, army); | 567 AddUnitOfTypeToArmy(unitType2, army); |
568 AddUnitsOfTypeToArmy(2, unitType1, army); | 568 AddUnitsOfTypeToArmy(2, unitType1, army); |
569 RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1); | 569 RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1); |
570 req.AddUnitTypeRequirement(unitType2, 2, 3); | 570 req.AddUnitTypeRequirement(unitType2, 2, 3); |
571 Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Failed)); | 571 Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Failed)); |
572 Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 2 " + unitType2.Name + " for every 3 " + unitType1.Name + " (have 1 for 2).")); | 572 Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 2 × " + unitType2.Name + " for every 3 × " + unitType1.Name + " (have 1 for 2).")); |
573 } | 573 } |
574 | 574 |
575 [Test()] | 575 [Test()] |
576 public void TestValidatingArmyWithFourUnitsWithThreeOfUnitTypeAllowedForTwoOfUnitTypeRequiredAndThreeUnitsOfTypeFails() | 576 public void TestValidatingArmyWithFourUnitsWithThreeOfUnitTypeAllowedForTwoOfUnitTypeRequiredAndThreeUnitsOfTypeFails() |
577 { | 577 { |
579 AddUnitsOfTypeToArmy(3, unitType2, army); | 579 AddUnitsOfTypeToArmy(3, unitType2, army); |
580 AddUnitsOfTypeToArmy(4, unitType1, army); | 580 AddUnitsOfTypeToArmy(4, unitType1, army); |
581 RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1); | 581 RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1); |
582 req.AddUnitTypeRequirement(unitType2, 2, 3); | 582 req.AddUnitTypeRequirement(unitType2, 2, 3); |
583 Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Failed)); | 583 Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Failed)); |
584 Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 2 " + unitType2.Name + " for every 3 " + unitType1.Name + " (have 3 for 4).")); | 584 Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 2 × " + unitType2.Name + " for every 3 × " + unitType1.Name + " (have 3 for 4).")); |
585 } | 585 } |
586 | 586 |
587 [Test()] | 587 [Test()] |
588 public void TestValidatingArmyWithThreeUnitsAndTwoOfUnitTypeAllowedForOneUnitTypeRequiredAndOneUnitOfTypeFails() | 588 public void TestValidatingArmyWithThreeUnitsAndTwoOfUnitTypeAllowedForOneUnitTypeRequiredAndOneUnitOfTypeFails() |
589 { | 589 { |
593 AddUnitOfTypeToArmy(unitType1, army); | 593 AddUnitOfTypeToArmy(unitType1, army); |
594 AddUnitOfTypeToArmy(unitType1, army); | 594 AddUnitOfTypeToArmy(unitType1, army); |
595 RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1); | 595 RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1); |
596 req.AddUnitTypeRequirement(unitType2, 1, 2); | 596 req.AddUnitTypeRequirement(unitType2, 1, 2); |
597 Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Failed)); | 597 Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Failed)); |
598 Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 1 " + unitType2.Name + " for every 2 " + unitType1.Name + " (have 1 for 3).")); | 598 Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " for every 2 × " + unitType1.Name + " (have 1 for 3).")); |
599 } | 599 } |
600 | 600 |
601 [Test()] | 601 [Test()] |
602 public void TestValidatingArmyWithNoUnitsAndThreeForEachTwoCombinedUnitTypesRequiredIsNA() | 602 public void TestValidatingArmyWithNoUnitsAndThreeForEachTwoCombinedUnitTypesRequiredIsNA() |
603 { | 603 { |
678 AddUnitOfTypeToArmy(unitType2, army); | 678 AddUnitOfTypeToArmy(unitType2, army); |
679 AddUnitsOfTypeToArmy(7, unitType1, army); | 679 AddUnitsOfTypeToArmy(7, unitType1, army); |
680 RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1); | 680 RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1); |
681 req.AddUnitTypeRequirement(3, unitType2, unitType3); | 681 req.AddUnitTypeRequirement(3, unitType2, unitType3); |
682 Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Failed)); | 682 Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Failed)); |
683 Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 1 " + unitType2.Name + " or " + unitType3.Name + " for every 3 " + unitType1.Name + " (have 2 for 7).")); | 683 Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " or " + unitType3.Name + " for every 3 × " + unitType1.Name + " (have 2 for 7).")); |
684 } | 684 } |
685 | 685 |
686 [Test()] | 686 [Test()] |
687 public void TestValidatingArmyWithSevenUnitsWithThreeForEachTwoUnitTypeComboRequiredAndTwoUnitsOfOneTypeFails() | 687 public void TestValidatingArmyWithSevenUnitsWithThreeForEachTwoUnitTypeComboRequiredAndTwoUnitsOfOneTypeFails() |
688 { | 688 { |
690 AddUnitsOfTypeToArmy(2, unitType3, army); | 690 AddUnitsOfTypeToArmy(2, unitType3, army); |
691 AddUnitsOfTypeToArmy(7, unitType1, army); | 691 AddUnitsOfTypeToArmy(7, unitType1, army); |
692 RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1); | 692 RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1); |
693 req.AddUnitTypeRequirement(3, unitType2, unitType3); | 693 req.AddUnitTypeRequirement(3, unitType2, unitType3); |
694 Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Failed)); | 694 Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Failed)); |
695 Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 1 " + unitType2.Name + " or " + unitType3.Name + " for every 3 " + unitType1.Name + " (have 2 for 7).")); | 695 Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " or " + unitType3.Name + " for every 3 × " + unitType1.Name + " (have 2 for 7).")); |
696 } | 696 } |
697 | 697 |
698 [Test()] | 698 [Test()] |
699 public void TestValidatingArmyWithSevenUnitsWithThreeForEachTwoUnitTypeComboRequiredAndTwoUnitsOfOtherTypeFails() | 699 public void TestValidatingArmyWithSevenUnitsWithThreeForEachTwoUnitTypeComboRequiredAndTwoUnitsOfOtherTypeFails() |
700 { | 700 { |
702 AddUnitsOfTypeToArmy(2, unitType2, army); | 702 AddUnitsOfTypeToArmy(2, unitType2, army); |
703 AddUnitsOfTypeToArmy(7, unitType1, army); | 703 AddUnitsOfTypeToArmy(7, unitType1, army); |
704 RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1); | 704 RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1); |
705 req.AddUnitTypeRequirement(3, unitType2, unitType3); | 705 req.AddUnitTypeRequirement(3, unitType2, unitType3); |
706 Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Failed)); | 706 Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Failed)); |
707 Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 1 " + unitType2.Name + " or " + unitType3.Name + " for every 3 " + unitType1.Name + " (have 2 for 7).")); | 707 Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " or " + unitType3.Name + " for every 3 × " + unitType1.Name + " (have 2 for 7).")); |
708 } | 708 } |
709 | 709 |
710 private static void AddUnitsOfTypeToArmy(int count, UnitType unitType, Army army) | 710 private static void AddUnitsOfTypeToArmy(int count, UnitType unitType, Army army) |
711 { | 711 { |
712 for (int i = 0; i < count; i++) | 712 for (int i = 0; i < count; i++) |