Mercurial > repos > IBBoard.WarFoundry.API.Tests
annotate API/Objects/Requirement/UnitRequiresNUnitsForMUnitsRequirementTests.cs @ 237:833f72be715a default tip
* Remove rogue print statements
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Tue, 06 Nov 2012 20:58:48 +0000 |
parents | fd51527f6d64 |
children |
rev | line source |
---|---|
208
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
1 // This file (UnitRequiresNUnitsForMUnitsRequirementTest.cs) is a part of the IBBoard.WarFoundry.API.Tests project and is copyright 2011 IBBoard |
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
2 // |
c323770e61c2
Re #379: Fix validation of requirements to check for unit
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. |
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
4 using System; |
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
5 using NUnit.Framework; |
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
6 using IBBoard.WarFoundry.API.Objects.Mock; |
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
7 using NUnit.Framework.SyntaxHelpers; |
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
8 |
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
9 namespace IBBoard.WarFoundry.API.Objects.Requirement |
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
10 { |
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
11 [TestFixture()] |
217
9bf34e88da89
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
214
diff
changeset
|
12 public class UnitRequiresNUnitsForMUnitsRequirementTests : AbstractUnitTypeUnitRequirementTest<UnitType, UnitRequiresNUnitsForMUnitsRequirement> |
208
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
13 { |
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
14 [Test()] |
210
649759343da5
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
209
diff
changeset
|
15 public void TestAddingUnitTypeWithNoUnitsAndOneUnitTypeRequiredFails() |
649759343da5
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
209
diff
changeset
|
16 { |
649759343da5
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
209
diff
changeset
|
17 Army army = new Army(mockRace, "Test", 1000); |
649759343da5
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
209
diff
changeset
|
18 UnitRequiresNUnitsForMUnitsRequirement req = new UnitRequiresNUnitsForMUnitsRequirement(unitType1); |
649759343da5
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
209
diff
changeset
|
19 req.AddUnitTypeRequirement(unitType2); |
649759343da5
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
209
diff
changeset
|
20 Assert_That__FailsAdding(req, unitType1, army, "Army must contain: 1 × " + unitType2.Name + " for every 1 × " + unitType1.Name + " (would have 0 for 1)."); |
649759343da5
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
209
diff
changeset
|
21 } |
649759343da5
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
209
diff
changeset
|
22 |
649759343da5
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
209
diff
changeset
|
23 [Test()] |
649759343da5
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
209
diff
changeset
|
24 public void TestAddingUnitTypeWithOneUnitAndOneUnitTypeRequiredPasses() |
208
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
25 { |
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
26 Army army = new Army(mockRace, "Test", 1000); |
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
27 AddUnitOfTypeToArmy(unitType2, army); |
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
28 UnitRequiresNUnitsForMUnitsRequirement req = new UnitRequiresNUnitsForMUnitsRequirement(unitType1); |
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
29 req.AddUnitTypeRequirement(unitType2); |
210
649759343da5
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
209
diff
changeset
|
30 Assert_That__PassesAdding(req, unitType1, army); |
649759343da5
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
209
diff
changeset
|
31 } |
649759343da5
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
209
diff
changeset
|
32 |
649759343da5
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
209
diff
changeset
|
33 [Test()] |
649759343da5
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
209
diff
changeset
|
34 public void TestAddingUnitTypeWithOneUnitAndOneUnitTypeRequiredPassesWhenAddingRequiredUnitType() |
649759343da5
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
209
diff
changeset
|
35 { |
649759343da5
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
209
diff
changeset
|
36 Army army = new Army(mockRace, "Test", 1000); |
649759343da5
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
209
diff
changeset
|
37 AddUnitOfTypeToArmy(unitType1, army); |
649759343da5
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
209
diff
changeset
|
38 UnitRequiresNUnitsForMUnitsRequirement req = new UnitRequiresNUnitsForMUnitsRequirement(unitType1); |
649759343da5
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
209
diff
changeset
|
39 req.AddUnitTypeRequirement(unitType2); |
649759343da5
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
209
diff
changeset
|
40 Assert_That__PassesAdding(req, unitType2, army); |
208
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
41 } |
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
42 |
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
43 [Test()] |
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
44 public void TestAddingUnitTypeSetsLimit() |
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
45 { |
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
46 Army army = new Army(mockRace, "Test", 1000); |
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
47 AddUnitOfTypeToArmy(unitType2, army); |
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
48 UnitRequiresNUnitsForMUnitsRequirement req = new UnitRequiresNUnitsForMUnitsRequirement(unitType1); |
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
49 req.AddUnitTypeRequirement(unitType2, 1); |
210
649759343da5
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
209
diff
changeset
|
50 Assert_That__PassesAdding(req, unitType1, army); |
208
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
51 } |
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
52 |
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
53 [Test()] |
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
54 public void TestAddingUnitTypeSetsLimitForFailure() |
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
55 { |
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
56 Army army = new Army(mockRace, "Test", 1000); |
210
649759343da5
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
209
diff
changeset
|
57 AddUnitOfTypeToArmy(unitType1, army); |
208
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
58 AddUnitOfTypeToArmy(unitType2, army); |
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
59 UnitRequiresNUnitsForMUnitsRequirement req = new UnitRequiresNUnitsForMUnitsRequirement(unitType1); |
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
60 req.AddUnitTypeRequirement(unitType2, 1); |
210
649759343da5
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
209
diff
changeset
|
61 Assert_That__FailsAdding(req, unitType1, army, "Army must contain: 1 × " + unitType2.Name + " for every 1 × " + unitType1.Name + " (would have 1 for 2)."); |
208
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
62 } |
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
63 |
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
64 [Test()] |
210
649759343da5
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
209
diff
changeset
|
65 public void TestAddingUnitTriggersPass() |
208
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
66 { |
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
67 Army army = new Army(mockRace, "Test", 1000); |
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
68 UnitRequiresNUnitsForMUnitsRequirement req = new UnitRequiresNUnitsForMUnitsRequirement(unitType1); |
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
69 req.AddUnitTypeRequirement(unitType2, 1); |
210
649759343da5
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
209
diff
changeset
|
70 Assert_That__FailsAdding(req, unitType1, army, "Army must contain: 1 × " + unitType2.Name + " for every 1 × " + unitType1.Name + " (would have 0 for 1)."); |
208
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
71 AddUnitOfTypeToArmy(unitType2, army); |
210
649759343da5
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
209
diff
changeset
|
72 Assert_That__PassesAdding(req, unitType1, army); |
208
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
73 } |
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
74 |
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
75 [Test()] |
211
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
76 public void TestAddingLimitedUnitTriggersFailure() |
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
77 { |
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
78 Army army = new Army(mockRace, "Test", 1000); |
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
79 AddUnitOfTypeToArmy(unitType1, army); |
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
80 UnitRequiresNUnitsForMUnitsRequirement req = new UnitRequiresNUnitsForMUnitsRequirement(unitType1); |
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
81 req.AddUnitTypeRequirement(unitType2); |
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
82 Assert_That__PassesAdding(req, unitType2, army); |
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
83 AddUnitOfTypeToArmy(unitType1, army); |
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
84 Assert_That__FailsAdding(req, unitType2, army, "Army must contain: 1 × " + unitType2.Name + " for every 1 × " + unitType1.Name + " (would have 1 for 2)."); |
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
85 } |
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
86 |
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
87 [Test()] |
209
fc9a90d29ae0
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
208
diff
changeset
|
88 public void TestAddingUnitTypeDefaultsToOne() |
208
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
89 { |
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
90 Army army = new Army(mockRace, "Test", 1000); |
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
91 UnitRequiresNUnitsForMUnitsRequirement req = new UnitRequiresNUnitsForMUnitsRequirement(unitType1); |
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
92 req.AddUnitTypeRequirement(unitType2); |
210
649759343da5
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
209
diff
changeset
|
93 Assert_That__FailsAdding(req, unitType1, army, "Army must contain: 1 × " + unitType2.Name + " for every 1 × " + unitType1.Name + " (would have 0 for 1)."); |
208
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
94 AddUnitOfTypeToArmy(unitType2, army); |
210
649759343da5
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
209
diff
changeset
|
95 Assert_That__PassesAdding(req, unitType1, army); |
208
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
96 } |
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
97 |
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
98 [Test] |
210
649759343da5
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
209
diff
changeset
|
99 public void TestRequirementNotApplicableWhenCheckingAddForNonLimitedUnits() |
649759343da5
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
209
diff
changeset
|
100 { |
649759343da5
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
209
diff
changeset
|
101 Army army = new Army(mockRace, "Test", 1000); |
649759343da5
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
209
diff
changeset
|
102 UnitRequiresNUnitsForMUnitsRequirement req = new UnitRequiresNUnitsForMUnitsRequirement(unitType1); |
649759343da5
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
209
diff
changeset
|
103 req.AddUnitTypeRequirement(unitType2); |
649759343da5
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
209
diff
changeset
|
104 Assert_That__AddingNotApplicable(req, unitType3, army); |
649759343da5
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
209
diff
changeset
|
105 Assert_That__AddingNotApplicable(req, unitType2, army); |
649759343da5
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
209
diff
changeset
|
106 } |
649759343da5
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
209
diff
changeset
|
107 |
649759343da5
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
209
diff
changeset
|
108 [Test] |
649759343da5
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
209
diff
changeset
|
109 public void TestRequirementNotApplicableAfterAddingLimitedUnit() |
208
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
110 { |
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
111 Army army = new Army(mockRace, "Test", 1000); |
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
112 UnitRequiresNUnitsForMUnitsRequirement req = new UnitRequiresNUnitsForMUnitsRequirement(unitType1); |
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
113 req.AddUnitTypeRequirement(unitType2); |
210
649759343da5
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
209
diff
changeset
|
114 Assert_That__AddingNotApplicable(req, unitType3, army); |
649759343da5
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
209
diff
changeset
|
115 AddUnitOfTypeToArmy(unitType1, army); |
649759343da5
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
209
diff
changeset
|
116 Assert_That__AddingNotApplicable(req, unitType3, army); |
208
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
117 } |
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
118 |
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
119 [Test] |
210
649759343da5
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
209
diff
changeset
|
120 public void TestRequirementNotApplicableBecomesPassAfterAddingLimitedUnit() |
208
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
121 { |
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
122 Army army = new Army(mockRace, "Test", 1000); |
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
123 UnitRequiresNUnitsForMUnitsRequirement req = new UnitRequiresNUnitsForMUnitsRequirement(unitType1); |
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
124 req.AddUnitTypeRequirement(unitType2); |
210
649759343da5
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
209
diff
changeset
|
125 Assert_That__AddingNotApplicable(req, unitType2, army); |
649759343da5
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
209
diff
changeset
|
126 AddUnitOfTypeToArmy(unitType1, army); |
649759343da5
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
209
diff
changeset
|
127 Assert_That__PassesAdding(req, unitType2, army); |
649759343da5
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
209
diff
changeset
|
128 } |
649759343da5
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
209
diff
changeset
|
129 |
649759343da5
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
209
diff
changeset
|
130 [Test] |
649759343da5
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
209
diff
changeset
|
131 public void TestRequirementNotApplicableBecomesFailAfterAddingLimitedUnit() |
649759343da5
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
209
diff
changeset
|
132 { |
649759343da5
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
209
diff
changeset
|
133 Army army = new Army(mockRace, "Test", 1000); |
649759343da5
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
209
diff
changeset
|
134 UnitRequiresNUnitsForMUnitsRequirement req = new UnitRequiresNUnitsForMUnitsRequirement(unitType1); |
649759343da5
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
209
diff
changeset
|
135 req.AddUnitTypeRequirement(unitType2, 2, 1); |
649759343da5
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
209
diff
changeset
|
136 Assert_That__AddingNotApplicable(req, unitType2, army); |
649759343da5
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
209
diff
changeset
|
137 AddUnitOfTypeToArmy(unitType1, army); |
649759343da5
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
209
diff
changeset
|
138 Assert_That__FailsAdding(req, unitType2, army, "Army must contain: 2 × " + unitType2.Name + " for every 1 × " + unitType1.Name + " (would have 1 for 1)."); |
208
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
139 } |
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
140 |
211
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
141 [Test] |
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
142 public void TestRequirementFailsWhenLimitedUnitsChange() |
208
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
143 { |
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
144 Army army = new Army(mockRace, "Test", 1000); |
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
145 AddUnitOfTypeToArmy(unitType1, army); |
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
146 UnitRequiresNUnitsForMUnitsRequirement req = new UnitRequiresNUnitsForMUnitsRequirement(unitType1); |
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
147 req.AddUnitTypeRequirement(unitType2); |
210
649759343da5
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
209
diff
changeset
|
148 Assert_That__PassesAdding(req, unitType2, army); |
649759343da5
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
209
diff
changeset
|
149 AddUnitOfTypeToArmy(unitType1, army); |
649759343da5
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
209
diff
changeset
|
150 Assert_That__FailsAdding(req, unitType2, army, "Army must contain: 1 × " + unitType2.Name + " for every 1 × " + unitType1.Name + " (would have 1 for 2)."); |
649759343da5
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
209
diff
changeset
|
151 } |
649759343da5
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
209
diff
changeset
|
152 |
649759343da5
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
209
diff
changeset
|
153 [Test] |
220
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
154 public void TestAddingRequirementWithOR() |
219
f951595143a9
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
217
diff
changeset
|
155 { |
f951595143a9
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
217
diff
changeset
|
156 Army army = new Army(mockRace, "Test", 1000); |
f951595143a9
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
217
diff
changeset
|
157 UnitRequiresNUnitsForMUnitsRequirement req = new UnitRequiresNUnitsForMUnitsRequirement(unitType1); |
f951595143a9
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
217
diff
changeset
|
158 req.AddUnitTypeRequirement(unitType2, unitType3); |
f951595143a9
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
217
diff
changeset
|
159 Assert_That__FailsAdding(req, unitType1, army, "Army must contain: 1 × " + unitType2.Name + " or " + unitType3.Name + " for every 1 × " + unitType1.Name + " (would have 0 for 1)."); |
f951595143a9
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
217
diff
changeset
|
160 AddUnitOfTypeToArmy(unitType2, army); |
f951595143a9
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
217
diff
changeset
|
161 Assert_That__PassesAdding(req, unitType1, army); |
f951595143a9
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
217
diff
changeset
|
162 } |
f951595143a9
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
217
diff
changeset
|
163 |
f951595143a9
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
217
diff
changeset
|
164 [Test] |
220
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
165 public void TestAddingRequirementWithORWithOtherUnit() |
219
f951595143a9
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
217
diff
changeset
|
166 { |
f951595143a9
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
217
diff
changeset
|
167 Army army = new Army(mockRace, "Test", 1000); |
f951595143a9
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
217
diff
changeset
|
168 UnitRequiresNUnitsForMUnitsRequirement req = new UnitRequiresNUnitsForMUnitsRequirement(unitType1); |
f951595143a9
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
217
diff
changeset
|
169 req.AddUnitTypeRequirement(unitType2, unitType3); |
f951595143a9
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
217
diff
changeset
|
170 Assert_That__FailsAdding(req, unitType1, army, "Army must contain: 1 × " + unitType2.Name + " or " + unitType3.Name + " for every 1 × " + unitType1.Name + " (would have 0 for 1)."); |
221 | 171 AddUnitOfTypeToArmy(unitType3, army); |
219
f951595143a9
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
217
diff
changeset
|
172 Assert_That__PassesAdding(req, unitType1, army); |
f951595143a9
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
217
diff
changeset
|
173 } |
f951595143a9
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
217
diff
changeset
|
174 |
f951595143a9
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
217
diff
changeset
|
175 [Test] |
220
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
176 public void TestAddingRequirementWithORWithLimit() |
219
f951595143a9
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
217
diff
changeset
|
177 { |
f951595143a9
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
217
diff
changeset
|
178 Army army = new Army(mockRace, "Test", 1000); |
f951595143a9
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
217
diff
changeset
|
179 UnitRequiresNUnitsForMUnitsRequirement req = new UnitRequiresNUnitsForMUnitsRequirement(unitType1); |
f951595143a9
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
217
diff
changeset
|
180 req.AddUnitTypeRequirement(2, 1, unitType2, unitType3); |
f951595143a9
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
217
diff
changeset
|
181 Assert_That__FailsAdding(req, unitType1, army, "Army must contain: 2 × " + unitType2.Name + " or " + unitType3.Name + " for every 1 × " + unitType1.Name + " (would have 0 for 1)."); |
f951595143a9
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
217
diff
changeset
|
182 AddUnitOfTypeToArmy(unitType2, army); |
f951595143a9
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
217
diff
changeset
|
183 Assert_That__FailsAdding(req, unitType1, army, "Army must contain: 2 × " + unitType2.Name + " or " + unitType3.Name + " for every 1 × " + unitType1.Name + " (would have 1 for 1)."); |
f951595143a9
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
217
diff
changeset
|
184 AddUnitOfTypeToArmy(unitType2, army); |
f951595143a9
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
217
diff
changeset
|
185 Assert_That__PassesAdding(req, unitType1, army); |
f951595143a9
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
217
diff
changeset
|
186 } |
f951595143a9
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
217
diff
changeset
|
187 |
f951595143a9
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
217
diff
changeset
|
188 [Test] |
220
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
189 public void TestAddingRequirementWithORWithLimitWithOtherUnit() |
219
f951595143a9
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
217
diff
changeset
|
190 { |
f951595143a9
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
217
diff
changeset
|
191 Army army = new Army(mockRace, "Test", 1000); |
f951595143a9
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
217
diff
changeset
|
192 UnitRequiresNUnitsForMUnitsRequirement req = new UnitRequiresNUnitsForMUnitsRequirement(unitType1); |
f951595143a9
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
217
diff
changeset
|
193 req.AddUnitTypeRequirement(2, 1, unitType2, unitType3); |
f951595143a9
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
217
diff
changeset
|
194 Assert_That__FailsAdding(req, unitType1, army, "Army must contain: 2 × " + unitType2.Name + " or " + unitType3.Name + " for every 1 × " + unitType1.Name + " (would have 0 for 1)."); |
f951595143a9
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
217
diff
changeset
|
195 AddUnitOfTypeToArmy(unitType3, army); |
f951595143a9
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
217
diff
changeset
|
196 Assert_That__FailsAdding(req, unitType1, army, "Army must contain: 2 × " + unitType2.Name + " or " + unitType3.Name + " for every 1 × " + unitType1.Name + " (would have 1 for 1)."); |
f951595143a9
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
217
diff
changeset
|
197 AddUnitOfTypeToArmy(unitType3, army); |
f951595143a9
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
217
diff
changeset
|
198 Assert_That__PassesAdding(req, unitType1, army); |
f951595143a9
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
217
diff
changeset
|
199 } |
f951595143a9
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
217
diff
changeset
|
200 |
f951595143a9
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
217
diff
changeset
|
201 [Test] |
220
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
202 public void TestAddingRequirementWithORWithLimitWithBothUnits() |
219
f951595143a9
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
217
diff
changeset
|
203 { |
f951595143a9
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
217
diff
changeset
|
204 Army army = new Army(mockRace, "Test", 1000); |
f951595143a9
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
217
diff
changeset
|
205 UnitRequiresNUnitsForMUnitsRequirement req = new UnitRequiresNUnitsForMUnitsRequirement(unitType1); |
f951595143a9
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
217
diff
changeset
|
206 req.AddUnitTypeRequirement(2, 1, unitType2, unitType3); |
f951595143a9
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
217
diff
changeset
|
207 Assert_That__FailsAdding(req, unitType1, army, "Army must contain: 2 × " + unitType2.Name + " or " + unitType3.Name + " for every 1 × " + unitType1.Name + " (would have 0 for 1)."); |
f951595143a9
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
217
diff
changeset
|
208 AddUnitOfTypeToArmy(unitType2, army); |
f951595143a9
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
217
diff
changeset
|
209 Assert_That__FailsAdding(req, unitType1, army, "Army must contain: 2 × " + unitType2.Name + " or " + unitType3.Name + " for every 1 × " + unitType1.Name + " (would have 1 for 1)."); |
f951595143a9
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
217
diff
changeset
|
210 AddUnitOfTypeToArmy(unitType3, army); |
f951595143a9
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
217
diff
changeset
|
211 Assert_That__PassesAdding(req, unitType1, army); |
f951595143a9
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
217
diff
changeset
|
212 } |
f951595143a9
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
217
diff
changeset
|
213 |
f951595143a9
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
217
diff
changeset
|
214 [Test] |
220
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
215 public void TestAddingRequirementWithORBasedOnRollcall() |
219
f951595143a9
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
217
diff
changeset
|
216 { |
f951595143a9
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
217
diff
changeset
|
217 Army army = new Army(mockRace, "Test", 1000); |
f951595143a9
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
217
diff
changeset
|
218 UnitRequiresNUnitsForMUnitsRequirement req = new UnitRequiresNUnitsForMUnitsRequirement(unitType1); |
f951595143a9
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
217
diff
changeset
|
219 req.AddUnitTypeRequirement(2, unitType2, unitType3); |
f951595143a9
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
217
diff
changeset
|
220 AddUnitsOfTypeToArmy(3, unitType2, army); |
f951595143a9
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
217
diff
changeset
|
221 AddUnitsOfTypeToArmy(2, unitType3, army); |
f951595143a9
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
217
diff
changeset
|
222 AddUnitsOfTypeToArmy(9, unitType1, army); |
f951595143a9
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
217
diff
changeset
|
223 Assert_That__PassesAdding(req, unitType1, army); |
f951595143a9
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
217
diff
changeset
|
224 AddUnitOfTypeToArmy(unitType1, army); |
f951595143a9
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
217
diff
changeset
|
225 Assert_That__FailsAdding(req, unitType1, army, "Army must contain: 1 × " + unitType2.Name + " or " + unitType3.Name + " for every 2 × " + unitType1.Name + " (would have 5 for 11)."); |
f951595143a9
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
217
diff
changeset
|
226 } |
f951595143a9
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
217
diff
changeset
|
227 |
f951595143a9
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
217
diff
changeset
|
228 [Test] |
220
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
229 public void TestAddingRequirementWithoutORBasedOnRollcall() |
219
f951595143a9
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
217
diff
changeset
|
230 { |
f951595143a9
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
217
diff
changeset
|
231 Army army = new Army(mockRace, "Test", 1000); |
f951595143a9
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
217
diff
changeset
|
232 UnitRequiresNUnitsForMUnitsRequirement req = new UnitRequiresNUnitsForMUnitsRequirement(unitType1); |
f951595143a9
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
217
diff
changeset
|
233 req.AddUnitTypeRequirement(2, unitType2); |
f951595143a9
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
217
diff
changeset
|
234 req.AddUnitTypeRequirement(2, unitType3); |
f951595143a9
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
217
diff
changeset
|
235 AddUnitsOfTypeToArmy(3, unitType2, army); |
f951595143a9
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
217
diff
changeset
|
236 AddUnitsOfTypeToArmy(2, unitType3, army); |
f951595143a9
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
217
diff
changeset
|
237 AddUnitsOfTypeToArmy(3, unitType1, army); |
f951595143a9
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
217
diff
changeset
|
238 Assert_That__PassesAdding(req, unitType1, army); |
f951595143a9
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
217
diff
changeset
|
239 AddUnitOfTypeToArmy(unitType1, army); |
f951595143a9
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
217
diff
changeset
|
240 Assert_That__FailsAdding(req, unitType1, army, "Army must contain: 1 × " + unitType3.Name + " for every 2 × " + unitType1.Name + " (would have 2 for 5)."); |
f951595143a9
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
217
diff
changeset
|
241 } |
f951595143a9
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
217
diff
changeset
|
242 |
f951595143a9
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
217
diff
changeset
|
243 [Test] |
210
649759343da5
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
209
diff
changeset
|
244 public void TestValidationNotApplicableWithNoLimitedUnit() |
649759343da5
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
209
diff
changeset
|
245 { |
649759343da5
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
209
diff
changeset
|
246 Army army = new Army(mockRace, "Test", 1000); |
649759343da5
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
209
diff
changeset
|
247 UnitRequiresNUnitsForMUnitsRequirement req = new UnitRequiresNUnitsForMUnitsRequirement(unitType1); |
649759343da5
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
209
diff
changeset
|
248 req.AddUnitTypeRequirement(unitType2); |
211
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
249 Assert_That__NotApplicable(req, army); |
210
649759343da5
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
209
diff
changeset
|
250 AddUnitOfTypeToArmy(unitType3, army); |
211
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
251 Assert_That__NotApplicable(req, army); |
210
649759343da5
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
209
diff
changeset
|
252 AddUnitOfTypeToArmy(unitType2, army); |
211
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
253 Assert_That__NotApplicable(req, army); |
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
254 } |
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
255 |
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
256 [Test()] |
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
257 public void TestValidatingWithNoUnitsAndOneUnitTypeRequiredFails() |
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
258 { |
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
259 Army army = new Army(mockRace, "Test", 1000); |
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
260 AddUnitOfTypeToArmy(unitType1, army); |
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
261 UnitRequiresNUnitsForMUnitsRequirement req = new UnitRequiresNUnitsForMUnitsRequirement(unitType1); |
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
262 req.AddUnitTypeRequirement(unitType2); |
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
263 Assert_That__ValidationFails(req, army, "Army must contain: 1 × " + unitType2.Name + " for every 1 × " + unitType1.Name + " (have 0 for 1)."); |
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
264 } |
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
265 |
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
266 [Test()] |
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
267 public void TestValidatingUnitWithOneUnitAndOneUnitTypeRequiredPasses() |
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
268 { |
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
269 Army army = new Army(mockRace, "Test", 1000); |
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
270 AddUnitOfTypeToArmy(unitType2, army); |
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
271 AddUnitOfTypeToArmy(unitType1, army); |
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
272 UnitRequiresNUnitsForMUnitsRequirement req = new UnitRequiresNUnitsForMUnitsRequirement(unitType1); |
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
273 req.AddUnitTypeRequirement(unitType2); |
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
274 Assert_That__ValidationPasses(req, army); |
210
649759343da5
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
209
diff
changeset
|
275 } |
649759343da5
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
209
diff
changeset
|
276 |
649759343da5
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
209
diff
changeset
|
277 [Test()] |
211
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
278 public void TestValidatingUnitTypeSetsLimit() |
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
279 { |
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
280 Army army = new Army(mockRace, "Test", 1000); |
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
281 AddUnitOfTypeToArmy(unitType2, army); |
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
282 AddUnitOfTypeToArmy(unitType1, army); |
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
283 UnitRequiresNUnitsForMUnitsRequirement req = new UnitRequiresNUnitsForMUnitsRequirement(unitType1); |
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
284 req.AddUnitTypeRequirement(unitType2, 1); |
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
285 Assert_That__ValidationPasses(req, army); |
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
286 } |
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
287 |
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
288 [Test()] |
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
289 public void TestValidatingUnitTypeSetsLimitForFailure() |
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
290 { |
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
291 Army army = new Army(mockRace, "Test", 1000); |
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
292 AddUnitOfTypeToArmy(unitType1, army); |
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
293 AddUnitOfTypeToArmy(unitType1, army); |
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
294 AddUnitOfTypeToArmy(unitType2, army); |
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
295 UnitRequiresNUnitsForMUnitsRequirement req = new UnitRequiresNUnitsForMUnitsRequirement(unitType1); |
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
296 req.AddUnitTypeRequirement(unitType2, 1); |
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
297 Assert_That__ValidationFails(req, army, "Army must contain: 1 × " + unitType2.Name + " for every 1 × " + unitType1.Name + " (have 1 for 2)."); |
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
298 } |
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
299 |
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
300 [Test()] |
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
301 public void TestAddingUnitTriggersValidationPass() |
210
649759343da5
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
209
diff
changeset
|
302 { |
649759343da5
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
209
diff
changeset
|
303 Army army = new Army(mockRace, "Test", 1000); |
649759343da5
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
209
diff
changeset
|
304 UnitRequiresNUnitsForMUnitsRequirement req = new UnitRequiresNUnitsForMUnitsRequirement(unitType1); |
211
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
305 req.AddUnitTypeRequirement(unitType2, 1); |
210
649759343da5
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
209
diff
changeset
|
306 AddUnitOfTypeToArmy(unitType1, army); |
211
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
307 Assert_That__ValidationFails(req, army, "Army must contain: 1 × " + unitType2.Name + " for every 1 × " + unitType1.Name + " (have 0 for 1)."); |
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
308 AddUnitOfTypeToArmy(unitType2, army); |
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
309 Assert_That__ValidationPasses(req, army); |
210
649759343da5
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
209
diff
changeset
|
310 } |
649759343da5
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
209
diff
changeset
|
311 |
649759343da5
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
209
diff
changeset
|
312 [Test()] |
211
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
313 public void TestAddingLimitedUnitTriggersValidationFailure() |
210
649759343da5
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
209
diff
changeset
|
314 { |
649759343da5
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
209
diff
changeset
|
315 Army army = new Army(mockRace, "Test", 1000); |
649759343da5
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
209
diff
changeset
|
316 AddUnitOfTypeToArmy(unitType1, army); |
649759343da5
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
209
diff
changeset
|
317 AddUnitOfTypeToArmy(unitType2, army); |
649759343da5
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
209
diff
changeset
|
318 UnitRequiresNUnitsForMUnitsRequirement req = new UnitRequiresNUnitsForMUnitsRequirement(unitType1); |
649759343da5
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
209
diff
changeset
|
319 req.AddUnitTypeRequirement(unitType2); |
211
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
320 Assert_That__ValidationPasses(req, army); |
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
321 AddUnitOfTypeToArmy(unitType1, army); |
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
322 Assert_That__ValidationFails(req, army, "Army must contain: 1 × " + unitType2.Name + " for every 1 × " + unitType1.Name + " (have 1 for 2)."); |
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
323 } |
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
324 |
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
325 [Test()] |
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
326 public void TestValidatingUnitTypeDefaultsToOne() |
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
327 { |
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
328 Army army = new Army(mockRace, "Test", 1000); |
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
329 UnitRequiresNUnitsForMUnitsRequirement req = new UnitRequiresNUnitsForMUnitsRequirement(unitType1); |
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
330 req.AddUnitTypeRequirement(unitType2); |
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
331 AddUnitOfTypeToArmy(unitType1, army); |
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
332 Assert_That__ValidationFails(req, army, "Army must contain: 1 × " + unitType2.Name + " for every 1 × " + unitType1.Name + " (have 0 for 1)."); |
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
333 AddUnitOfTypeToArmy(unitType2, army); |
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
334 Assert_That__ValidationPasses(req, army); |
210
649759343da5
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
209
diff
changeset
|
335 } |
649759343da5
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
209
diff
changeset
|
336 |
649759343da5
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
209
diff
changeset
|
337 [Test] |
211
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
338 public void TestValidationRequirementNotApplicableWhenCheckingForNonLimitedUnits() |
208
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
339 { |
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
340 Army army = new Army(mockRace, "Test", 1000); |
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
341 UnitRequiresNUnitsForMUnitsRequirement req = new UnitRequiresNUnitsForMUnitsRequirement(unitType1); |
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
342 req.AddUnitTypeRequirement(unitType2); |
211
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
343 AddUnitOfTypeToArmy(unitType3, army); |
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
344 Assert_That__NotApplicable(req, army); |
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
345 AddUnitOfTypeToArmy(unitType2, army); |
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
346 Assert_That__NotApplicable(req, army); |
208
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
347 } |
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
348 |
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
349 [Test] |
211
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
350 public void TestValidationNotApplicableBecomesPassAfterAddingLimitedUnit() |
208
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
351 { |
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
352 Army army = new Army(mockRace, "Test", 1000); |
211
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
353 UnitRequiresNUnitsForMUnitsRequirement req = new UnitRequiresNUnitsForMUnitsRequirement(unitType1); |
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
354 req.AddUnitTypeRequirement(unitType2); |
208
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
355 AddUnitOfTypeToArmy(unitType2, army); |
211
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
356 Assert_That__NotApplicable(req, army); |
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
357 AddUnitOfTypeToArmy(unitType1, army); |
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
358 Assert_That__ValidationPasses(req, army); |
208
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
359 } |
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
360 |
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
361 [Test] |
211
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
362 public void TestValidationRequirementNotApplicableBecomesFailAfterAddingLimitedUnit() |
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
363 { |
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
364 Army army = new Army(mockRace, "Test", 1000); |
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
365 UnitRequiresNUnitsForMUnitsRequirement req = new UnitRequiresNUnitsForMUnitsRequirement(unitType1); |
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
366 req.AddUnitTypeRequirement(unitType2, 2, 1); |
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
367 AddUnitOfTypeToArmy(unitType2, army); |
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
368 Assert_That__NotApplicable(req, army); |
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
369 AddUnitOfTypeToArmy(unitType1, army); |
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
370 Assert_That__ValidationFails(req, army, "Army must contain: 2 × " + unitType2.Name + " for every 1 × " + unitType1.Name + " (have 1 for 1)."); |
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
371 } |
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
372 |
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
373 [Test] |
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
374 public void TestValidationRequirementFailsWhenLimitedUnitsChange() |
208
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
375 { |
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
376 Army army = new Army(mockRace, "Test", 1000); |
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
377 AddUnitOfTypeToArmy(unitType1, army); |
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
378 AddUnitOfTypeToArmy(unitType2, army); |
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
379 UnitRequiresNUnitsForMUnitsRequirement req = new UnitRequiresNUnitsForMUnitsRequirement(unitType1); |
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
380 req.AddUnitTypeRequirement(unitType2); |
211
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
381 Assert_That__ValidationPasses(req, army); |
210
649759343da5
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
209
diff
changeset
|
382 AddUnitOfTypeToArmy(unitType1, army); |
211
bc782a0d47bf
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
210
diff
changeset
|
383 Assert_That__ValidationFails(req, army, "Army must contain: 1 × " + unitType2.Name + " for every 1 × " + unitType1.Name + " (have 1 for 2)."); |
210
649759343da5
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
209
diff
changeset
|
384 } |
217
9bf34e88da89
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
214
diff
changeset
|
385 |
220
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
386 [Test] |
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
387 public void TestRequirementWithOR() |
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
388 { |
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
389 Army army = new Army(mockRace, "Test", 1000); |
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
390 UnitRequiresNUnitsForMUnitsRequirement req = new UnitRequiresNUnitsForMUnitsRequirement(unitType1); |
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
391 req.AddUnitTypeRequirement(unitType2, unitType3); |
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
392 AddUnitOfTypeToArmy(unitType1, army); |
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
393 Assert_That__ValidationFails(req, army, "Army must contain: 1 × " + unitType2.Name + " or " + unitType3.Name + " for every 1 × " + unitType1.Name + " (have 0 for 1)."); |
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
394 AddUnitOfTypeToArmy(unitType2, army); |
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
395 Assert_That__ValidationPasses(req, army); |
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
396 } |
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
397 |
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
398 [Test] |
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
399 public void TestRequirementWithORWithOtherUnit() |
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
400 { |
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
401 Army army = new Army(mockRace, "Test", 1000); |
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
402 UnitRequiresNUnitsForMUnitsRequirement req = new UnitRequiresNUnitsForMUnitsRequirement(unitType1); |
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
403 req.AddUnitTypeRequirement(unitType2, unitType3); |
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
404 AddUnitOfTypeToArmy(unitType1, army); |
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
405 Assert_That__ValidationFails(req, army, "Army must contain: 1 × " + unitType2.Name + " or " + unitType3.Name + " for every 1 × " + unitType1.Name + " (have 0 for 1)."); |
221 | 406 AddUnitOfTypeToArmy(unitType3, army); |
220
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
407 Assert_That__ValidationPasses(req, army); |
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
408 } |
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
409 |
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
410 [Test] |
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
411 public void TestRequirementWithORWithLimit() |
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
412 { |
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
413 Army army = new Army(mockRace, "Test", 1000); |
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
414 UnitRequiresNUnitsForMUnitsRequirement req = new UnitRequiresNUnitsForMUnitsRequirement(unitType1); |
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
415 req.AddUnitTypeRequirement(2, 1, unitType2, unitType3); |
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
416 AddUnitOfTypeToArmy(unitType1, army); |
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
417 Assert_That__ValidationFails(req, army, "Army must contain: 2 × " + unitType2.Name + " or " + unitType3.Name + " for every 1 × " + unitType1.Name + " (have 0 for 1)."); |
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
418 AddUnitOfTypeToArmy(unitType2, army); |
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
419 Assert_That__ValidationFails(req, army, "Army must contain: 2 × " + unitType2.Name + " or " + unitType3.Name + " for every 1 × " + unitType1.Name + " (have 1 for 1)."); |
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
420 AddUnitOfTypeToArmy(unitType2, army); |
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
421 Assert_That__ValidationPasses(req, army); |
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
422 } |
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
423 |
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
424 [Test] |
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
425 public void TestRequirementWithORWithLimitWithOtherUnit() |
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
426 { |
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
427 Army army = new Army(mockRace, "Test", 1000); |
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
428 UnitRequiresNUnitsForMUnitsRequirement req = new UnitRequiresNUnitsForMUnitsRequirement(unitType1); |
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
429 req.AddUnitTypeRequirement(2, 1, unitType2, unitType3); |
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
430 AddUnitOfTypeToArmy(unitType1, army); |
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
431 Assert_That__ValidationFails(req, army, "Army must contain: 2 × " + unitType2.Name + " or " + unitType3.Name + " for every 1 × " + unitType1.Name + " (have 0 for 1)."); |
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
432 AddUnitOfTypeToArmy(unitType3, army); |
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
433 Assert_That__ValidationFails(req, army, "Army must contain: 2 × " + unitType2.Name + " or " + unitType3.Name + " for every 1 × " + unitType1.Name + " (have 1 for 1)."); |
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
434 AddUnitOfTypeToArmy(unitType3, army); |
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
435 Assert_That__ValidationPasses(req, army); |
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
436 } |
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
437 |
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
438 [Test] |
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
439 public void TestRequirementWithORWithLimitWithBothUnits() |
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
440 { |
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
441 Army army = new Army(mockRace, "Test", 1000); |
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
442 UnitRequiresNUnitsForMUnitsRequirement req = new UnitRequiresNUnitsForMUnitsRequirement(unitType1); |
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
443 req.AddUnitTypeRequirement(2, 1, unitType2, unitType3); |
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
444 AddUnitOfTypeToArmy(unitType1, army); |
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
445 Assert_That__ValidationFails(req, army, "Army must contain: 2 × " + unitType2.Name + " or " + unitType3.Name + " for every 1 × " + unitType1.Name + " (have 0 for 1)."); |
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
446 AddUnitOfTypeToArmy(unitType2, army); |
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
447 Assert_That__ValidationFails(req, army, "Army must contain: 2 × " + unitType2.Name + " or " + unitType3.Name + " for every 1 × " + unitType1.Name + " (have 1 for 1)."); |
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
448 AddUnitOfTypeToArmy(unitType3, army); |
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
449 Assert_That__ValidationPasses(req, army); |
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
450 } |
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
451 |
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
452 [Test] |
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
453 public void TestRequirementWithORBasedOnRollcall() |
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
454 { |
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
455 Army army = new Army(mockRace, "Test", 1000); |
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
456 UnitRequiresNUnitsForMUnitsRequirement req = new UnitRequiresNUnitsForMUnitsRequirement(unitType1); |
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
457 req.AddUnitTypeRequirement(2, unitType2, unitType3); |
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
458 AddUnitsOfTypeToArmy(3, unitType2, army); |
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
459 AddUnitsOfTypeToArmy(2, unitType3, army); |
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
460 AddUnitsOfTypeToArmy(10, unitType1, army); |
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
461 Assert_That__ValidationPasses(req, army); |
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
462 AddUnitOfTypeToArmy(unitType1, army); |
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
463 Assert_That__ValidationFails(req, army, "Army must contain: 1 × " + unitType2.Name + " or " + unitType3.Name + " for every 2 × " + unitType1.Name + " (have 5 for 11)."); |
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
464 } |
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
465 |
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
466 [Test] |
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
467 public void TestRequirementWithoutORBasedOnRollcall() |
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
468 { |
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
469 Army army = new Army(mockRace, "Test", 1000); |
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
470 UnitRequiresNUnitsForMUnitsRequirement req = new UnitRequiresNUnitsForMUnitsRequirement(unitType1); |
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
471 req.AddUnitTypeRequirement(2, unitType2); |
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
472 req.AddUnitTypeRequirement(2, unitType3); |
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
473 AddUnitsOfTypeToArmy(3, unitType2, army); |
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
474 AddUnitsOfTypeToArmy(2, unitType3, army); |
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
475 AddUnitsOfTypeToArmy(4, unitType1, army); |
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
476 Assert_That__ValidationPasses(req, army); |
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
477 AddUnitOfTypeToArmy(unitType1, army); |
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
478 Assert_That__ValidationFails(req, army, "Army must contain: 1 × " + unitType3.Name + " for every 2 × " + unitType1.Name + " (have 2 for 5)."); |
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
479 } |
0fa634c6391b
Re #394: Make requirements (or factory) more closely match Rollcall methods
IBBoard <dev@ibboard.co.uk>
parents:
219
diff
changeset
|
480 |
222
12ac487af0ba
Re #395: Requirements can incorrectly allow based on common divisor
IBBoard <dev@ibboard.co.uk>
parents:
221
diff
changeset
|
481 [Test] |
12ac487af0ba
Re #395: Requirements can incorrectly allow based on common divisor
IBBoard <dev@ibboard.co.uk>
parents:
221
diff
changeset
|
482 public void TestBug395RequirementShouldNotFindCommonDivisorAdding() |
12ac487af0ba
Re #395: Requirements can incorrectly allow based on common divisor
IBBoard <dev@ibboard.co.uk>
parents:
221
diff
changeset
|
483 { |
12ac487af0ba
Re #395: Requirements can incorrectly allow based on common divisor
IBBoard <dev@ibboard.co.uk>
parents:
221
diff
changeset
|
484 Army army = new Army(mockRace, "Test", 1000); |
12ac487af0ba
Re #395: Requirements can incorrectly allow based on common divisor
IBBoard <dev@ibboard.co.uk>
parents:
221
diff
changeset
|
485 UnitRequiresNUnitsForMUnitsRequirement req = new UnitRequiresNUnitsForMUnitsRequirement(unitType1); |
12ac487af0ba
Re #395: Requirements can incorrectly allow based on common divisor
IBBoard <dev@ibboard.co.uk>
parents:
221
diff
changeset
|
486 req.AddUnitTypeRequirement(4, 2, unitType2); |
12ac487af0ba
Re #395: Requirements can incorrectly allow based on common divisor
IBBoard <dev@ibboard.co.uk>
parents:
221
diff
changeset
|
487 AddUnitsOfTypeToArmy(3, unitType2, army); |
12ac487af0ba
Re #395: Requirements can incorrectly allow based on common divisor
IBBoard <dev@ibboard.co.uk>
parents:
221
diff
changeset
|
488 Assert_That__FailsAdding(req, unitType1, army, "Army must contain: 4 × " + unitType2.Name + " for every 2 × " + unitType1.Name + " (would have 3 for 1)."); |
12ac487af0ba
Re #395: Requirements can incorrectly allow based on common divisor
IBBoard <dev@ibboard.co.uk>
parents:
221
diff
changeset
|
489 AddUnitOfTypeToArmy(unitType2, army); |
12ac487af0ba
Re #395: Requirements can incorrectly allow based on common divisor
IBBoard <dev@ibboard.co.uk>
parents:
221
diff
changeset
|
490 Assert_That__PassesAdding(req, unitType1, army); |
12ac487af0ba
Re #395: Requirements can incorrectly allow based on common divisor
IBBoard <dev@ibboard.co.uk>
parents:
221
diff
changeset
|
491 AddUnitOfTypeToArmy(unitType1, army); |
12ac487af0ba
Re #395: Requirements can incorrectly allow based on common divisor
IBBoard <dev@ibboard.co.uk>
parents:
221
diff
changeset
|
492 Assert_That__PassesAdding(req, unitType1, army); |
12ac487af0ba
Re #395: Requirements can incorrectly allow based on common divisor
IBBoard <dev@ibboard.co.uk>
parents:
221
diff
changeset
|
493 AddUnitOfTypeToArmy(unitType1, army); |
12ac487af0ba
Re #395: Requirements can incorrectly allow based on common divisor
IBBoard <dev@ibboard.co.uk>
parents:
221
diff
changeset
|
494 Assert_That__FailsAdding(req, unitType1, army, "Army must contain: 4 × " + unitType2.Name + " for every 2 × " + unitType1.Name + " (would have 4 for 3)."); |
12ac487af0ba
Re #395: Requirements can incorrectly allow based on common divisor
IBBoard <dev@ibboard.co.uk>
parents:
221
diff
changeset
|
495 AddUnitOfTypeToArmy(unitType2, army); |
12ac487af0ba
Re #395: Requirements can incorrectly allow based on common divisor
IBBoard <dev@ibboard.co.uk>
parents:
221
diff
changeset
|
496 Assert_That__FailsAdding(req, unitType1, army, "Army must contain: 4 × " + unitType2.Name + " for every 2 × " + unitType1.Name + " (would have 5 for 3)."); |
223
fd51527f6d64
Re #395: Requirements can incorrectly allow based on common divisor
IBBoard <dev@ibboard.co.uk>
parents:
222
diff
changeset
|
497 AddUnitOfTypeToArmy(unitType2, army); |
fd51527f6d64
Re #395: Requirements can incorrectly allow based on common divisor
IBBoard <dev@ibboard.co.uk>
parents:
222
diff
changeset
|
498 Assert_That__FailsAdding(req, unitType1, army, "Army must contain: 4 × " + unitType2.Name + " for every 2 × " + unitType1.Name + " (would have 6 for 3)."); |
fd51527f6d64
Re #395: Requirements can incorrectly allow based on common divisor
IBBoard <dev@ibboard.co.uk>
parents:
222
diff
changeset
|
499 AddUnitsOfTypeToArmy(2, unitType2, army); |
222
12ac487af0ba
Re #395: Requirements can incorrectly allow based on common divisor
IBBoard <dev@ibboard.co.uk>
parents:
221
diff
changeset
|
500 Assert_That__PassesAdding(req, unitType1, army); |
12ac487af0ba
Re #395: Requirements can incorrectly allow based on common divisor
IBBoard <dev@ibboard.co.uk>
parents:
221
diff
changeset
|
501 } |
12ac487af0ba
Re #395: Requirements can incorrectly allow based on common divisor
IBBoard <dev@ibboard.co.uk>
parents:
221
diff
changeset
|
502 |
12ac487af0ba
Re #395: Requirements can incorrectly allow based on common divisor
IBBoard <dev@ibboard.co.uk>
parents:
221
diff
changeset
|
503 [Test] |
12ac487af0ba
Re #395: Requirements can incorrectly allow based on common divisor
IBBoard <dev@ibboard.co.uk>
parents:
221
diff
changeset
|
504 public void TestBug395RequirementShouldNotFindCommonDivisorValidating() |
12ac487af0ba
Re #395: Requirements can incorrectly allow based on common divisor
IBBoard <dev@ibboard.co.uk>
parents:
221
diff
changeset
|
505 { |
12ac487af0ba
Re #395: Requirements can incorrectly allow based on common divisor
IBBoard <dev@ibboard.co.uk>
parents:
221
diff
changeset
|
506 Army army = new Army(mockRace, "Test", 1000); |
12ac487af0ba
Re #395: Requirements can incorrectly allow based on common divisor
IBBoard <dev@ibboard.co.uk>
parents:
221
diff
changeset
|
507 UnitRequiresNUnitsForMUnitsRequirement req = new UnitRequiresNUnitsForMUnitsRequirement(unitType1); |
12ac487af0ba
Re #395: Requirements can incorrectly allow based on common divisor
IBBoard <dev@ibboard.co.uk>
parents:
221
diff
changeset
|
508 req.AddUnitTypeRequirement(4, 2, unitType2); |
12ac487af0ba
Re #395: Requirements can incorrectly allow based on common divisor
IBBoard <dev@ibboard.co.uk>
parents:
221
diff
changeset
|
509 AddUnitsOfTypeToArmy(3, unitType2, army); |
12ac487af0ba
Re #395: Requirements can incorrectly allow based on common divisor
IBBoard <dev@ibboard.co.uk>
parents:
221
diff
changeset
|
510 AddUnitOfTypeToArmy(unitType1, army); |
12ac487af0ba
Re #395: Requirements can incorrectly allow based on common divisor
IBBoard <dev@ibboard.co.uk>
parents:
221
diff
changeset
|
511 Assert_That__ValidationFails(req, army, "Army must contain: 4 × " + unitType2.Name + " for every 2 × " + unitType1.Name + " (have 3 for 1)."); |
12ac487af0ba
Re #395: Requirements can incorrectly allow based on common divisor
IBBoard <dev@ibboard.co.uk>
parents:
221
diff
changeset
|
512 AddUnitOfTypeToArmy(unitType2, army); |
12ac487af0ba
Re #395: Requirements can incorrectly allow based on common divisor
IBBoard <dev@ibboard.co.uk>
parents:
221
diff
changeset
|
513 Assert_That__ValidationPasses(req, army); |
12ac487af0ba
Re #395: Requirements can incorrectly allow based on common divisor
IBBoard <dev@ibboard.co.uk>
parents:
221
diff
changeset
|
514 AddUnitOfTypeToArmy(unitType1, army); |
12ac487af0ba
Re #395: Requirements can incorrectly allow based on common divisor
IBBoard <dev@ibboard.co.uk>
parents:
221
diff
changeset
|
515 Assert_That__ValidationPasses(req, army); |
12ac487af0ba
Re #395: Requirements can incorrectly allow based on common divisor
IBBoard <dev@ibboard.co.uk>
parents:
221
diff
changeset
|
516 AddUnitOfTypeToArmy(unitType1, army); |
12ac487af0ba
Re #395: Requirements can incorrectly allow based on common divisor
IBBoard <dev@ibboard.co.uk>
parents:
221
diff
changeset
|
517 Assert_That__ValidationFails(req, army, "Army must contain: 4 × " + unitType2.Name + " for every 2 × " + unitType1.Name + " (have 4 for 3)."); |
12ac487af0ba
Re #395: Requirements can incorrectly allow based on common divisor
IBBoard <dev@ibboard.co.uk>
parents:
221
diff
changeset
|
518 AddUnitOfTypeToArmy(unitType2, army); |
12ac487af0ba
Re #395: Requirements can incorrectly allow based on common divisor
IBBoard <dev@ibboard.co.uk>
parents:
221
diff
changeset
|
519 Assert_That__ValidationFails(req, army, "Army must contain: 4 × " + unitType2.Name + " for every 2 × " + unitType1.Name + " (have 5 for 3)."); |
223
fd51527f6d64
Re #395: Requirements can incorrectly allow based on common divisor
IBBoard <dev@ibboard.co.uk>
parents:
222
diff
changeset
|
520 AddUnitOfTypeToArmy(unitType2, army); |
fd51527f6d64
Re #395: Requirements can incorrectly allow based on common divisor
IBBoard <dev@ibboard.co.uk>
parents:
222
diff
changeset
|
521 Assert_That__ValidationFails(req, army, "Army must contain: 4 × " + unitType2.Name + " for every 2 × " + unitType1.Name + " (have 6 for 3)."); |
fd51527f6d64
Re #395: Requirements can incorrectly allow based on common divisor
IBBoard <dev@ibboard.co.uk>
parents:
222
diff
changeset
|
522 AddUnitsOfTypeToArmy(2, unitType2, army); |
222
12ac487af0ba
Re #395: Requirements can incorrectly allow based on common divisor
IBBoard <dev@ibboard.co.uk>
parents:
221
diff
changeset
|
523 Assert_That__ValidationPasses(req, army); |
12ac487af0ba
Re #395: Requirements can incorrectly allow based on common divisor
IBBoard <dev@ibboard.co.uk>
parents:
221
diff
changeset
|
524 } |
12ac487af0ba
Re #395: Requirements can incorrectly allow based on common divisor
IBBoard <dev@ibboard.co.uk>
parents:
221
diff
changeset
|
525 |
12ac487af0ba
Re #395: Requirements can incorrectly allow based on common divisor
IBBoard <dev@ibboard.co.uk>
parents:
221
diff
changeset
|
526 [Test] |
12ac487af0ba
Re #395: Requirements can incorrectly allow based on common divisor
IBBoard <dev@ibboard.co.uk>
parents:
221
diff
changeset
|
527 public void TestBug395RequirementShouldNotFindCommonDivisorAddingMultiUnits() |
12ac487af0ba
Re #395: Requirements can incorrectly allow based on common divisor
IBBoard <dev@ibboard.co.uk>
parents:
221
diff
changeset
|
528 { |
12ac487af0ba
Re #395: Requirements can incorrectly allow based on common divisor
IBBoard <dev@ibboard.co.uk>
parents:
221
diff
changeset
|
529 Army army = new Army(mockRace, "Test", 1000); |
12ac487af0ba
Re #395: Requirements can incorrectly allow based on common divisor
IBBoard <dev@ibboard.co.uk>
parents:
221
diff
changeset
|
530 UnitRequiresNUnitsForMUnitsRequirement req = new UnitRequiresNUnitsForMUnitsRequirement(unitType1); |
12ac487af0ba
Re #395: Requirements can incorrectly allow based on common divisor
IBBoard <dev@ibboard.co.uk>
parents:
221
diff
changeset
|
531 req.AddUnitTypeRequirement(4, 2, unitType2, unitType3); |
12ac487af0ba
Re #395: Requirements can incorrectly allow based on common divisor
IBBoard <dev@ibboard.co.uk>
parents:
221
diff
changeset
|
532 AddUnitOfTypeToArmy(unitType3, army); |
12ac487af0ba
Re #395: Requirements can incorrectly allow based on common divisor
IBBoard <dev@ibboard.co.uk>
parents:
221
diff
changeset
|
533 AddUnitsOfTypeToArmy(2, unitType2, army); |
12ac487af0ba
Re #395: Requirements can incorrectly allow based on common divisor
IBBoard <dev@ibboard.co.uk>
parents:
221
diff
changeset
|
534 Assert_That__FailsAdding(req, unitType1, army, "Army must contain: 4 × " + unitType2.Name + " or " + unitType3.Name + " for every 2 × " + unitType1.Name + " (would have 3 for 1)."); |
12ac487af0ba
Re #395: Requirements can incorrectly allow based on common divisor
IBBoard <dev@ibboard.co.uk>
parents:
221
diff
changeset
|
535 AddUnitOfTypeToArmy(unitType2, army); |
12ac487af0ba
Re #395: Requirements can incorrectly allow based on common divisor
IBBoard <dev@ibboard.co.uk>
parents:
221
diff
changeset
|
536 Assert_That__PassesAdding(req, unitType1, army); |
12ac487af0ba
Re #395: Requirements can incorrectly allow based on common divisor
IBBoard <dev@ibboard.co.uk>
parents:
221
diff
changeset
|
537 AddUnitOfTypeToArmy(unitType1, army); |
12ac487af0ba
Re #395: Requirements can incorrectly allow based on common divisor
IBBoard <dev@ibboard.co.uk>
parents:
221
diff
changeset
|
538 Assert_That__PassesAdding(req, unitType1, army); |
12ac487af0ba
Re #395: Requirements can incorrectly allow based on common divisor
IBBoard <dev@ibboard.co.uk>
parents:
221
diff
changeset
|
539 AddUnitOfTypeToArmy(unitType1, army); |
12ac487af0ba
Re #395: Requirements can incorrectly allow based on common divisor
IBBoard <dev@ibboard.co.uk>
parents:
221
diff
changeset
|
540 Assert_That__FailsAdding(req, unitType1, army, "Army must contain: 4 × " + unitType2.Name + " or " + unitType3.Name + " for every 2 × " + unitType1.Name + " (would have 4 for 3)."); |
12ac487af0ba
Re #395: Requirements can incorrectly allow based on common divisor
IBBoard <dev@ibboard.co.uk>
parents:
221
diff
changeset
|
541 AddUnitOfTypeToArmy(unitType2, army); |
12ac487af0ba
Re #395: Requirements can incorrectly allow based on common divisor
IBBoard <dev@ibboard.co.uk>
parents:
221
diff
changeset
|
542 Assert_That__FailsAdding(req, unitType1, army, "Army must contain: 4 × " + unitType2.Name + " or " + unitType3.Name + " for every 2 × " + unitType1.Name + " (would have 5 for 3)."); |
223
fd51527f6d64
Re #395: Requirements can incorrectly allow based on common divisor
IBBoard <dev@ibboard.co.uk>
parents:
222
diff
changeset
|
543 AddUnitOfTypeToArmy(unitType2, army); |
fd51527f6d64
Re #395: Requirements can incorrectly allow based on common divisor
IBBoard <dev@ibboard.co.uk>
parents:
222
diff
changeset
|
544 Assert_That__FailsAdding(req, unitType1, army, "Army must contain: 4 × " + unitType2.Name + " or " + unitType3.Name + " for every 2 × " + unitType1.Name + " (would have 6 for 3)."); |
fd51527f6d64
Re #395: Requirements can incorrectly allow based on common divisor
IBBoard <dev@ibboard.co.uk>
parents:
222
diff
changeset
|
545 AddUnitsOfTypeToArmy(2, unitType2, army); |
222
12ac487af0ba
Re #395: Requirements can incorrectly allow based on common divisor
IBBoard <dev@ibboard.co.uk>
parents:
221
diff
changeset
|
546 Assert_That__PassesAdding(req, unitType1, army); |
12ac487af0ba
Re #395: Requirements can incorrectly allow based on common divisor
IBBoard <dev@ibboard.co.uk>
parents:
221
diff
changeset
|
547 } |
12ac487af0ba
Re #395: Requirements can incorrectly allow based on common divisor
IBBoard <dev@ibboard.co.uk>
parents:
221
diff
changeset
|
548 |
12ac487af0ba
Re #395: Requirements can incorrectly allow based on common divisor
IBBoard <dev@ibboard.co.uk>
parents:
221
diff
changeset
|
549 [Test] |
12ac487af0ba
Re #395: Requirements can incorrectly allow based on common divisor
IBBoard <dev@ibboard.co.uk>
parents:
221
diff
changeset
|
550 public void TestBug395RequirementShouldNotFindCommonDivisorValidatingMultiUnits() |
12ac487af0ba
Re #395: Requirements can incorrectly allow based on common divisor
IBBoard <dev@ibboard.co.uk>
parents:
221
diff
changeset
|
551 { |
12ac487af0ba
Re #395: Requirements can incorrectly allow based on common divisor
IBBoard <dev@ibboard.co.uk>
parents:
221
diff
changeset
|
552 Army army = new Army(mockRace, "Test", 1000); |
12ac487af0ba
Re #395: Requirements can incorrectly allow based on common divisor
IBBoard <dev@ibboard.co.uk>
parents:
221
diff
changeset
|
553 UnitRequiresNUnitsForMUnitsRequirement req = new UnitRequiresNUnitsForMUnitsRequirement(unitType1); |
12ac487af0ba
Re #395: Requirements can incorrectly allow based on common divisor
IBBoard <dev@ibboard.co.uk>
parents:
221
diff
changeset
|
554 req.AddUnitTypeRequirement(4, 2, unitType2, unitType3); |
12ac487af0ba
Re #395: Requirements can incorrectly allow based on common divisor
IBBoard <dev@ibboard.co.uk>
parents:
221
diff
changeset
|
555 AddUnitOfTypeToArmy(unitType3, army); |
12ac487af0ba
Re #395: Requirements can incorrectly allow based on common divisor
IBBoard <dev@ibboard.co.uk>
parents:
221
diff
changeset
|
556 AddUnitsOfTypeToArmy(2, unitType2, army); |
12ac487af0ba
Re #395: Requirements can incorrectly allow based on common divisor
IBBoard <dev@ibboard.co.uk>
parents:
221
diff
changeset
|
557 AddUnitOfTypeToArmy(unitType1, army); |
12ac487af0ba
Re #395: Requirements can incorrectly allow based on common divisor
IBBoard <dev@ibboard.co.uk>
parents:
221
diff
changeset
|
558 Assert_That__ValidationFails(req, army, "Army must contain: 4 × " + unitType2.Name + " or " + unitType3.Name + " for every 2 × " + unitType1.Name + " (have 3 for 1)."); |
12ac487af0ba
Re #395: Requirements can incorrectly allow based on common divisor
IBBoard <dev@ibboard.co.uk>
parents:
221
diff
changeset
|
559 AddUnitOfTypeToArmy(unitType2, army); |
12ac487af0ba
Re #395: Requirements can incorrectly allow based on common divisor
IBBoard <dev@ibboard.co.uk>
parents:
221
diff
changeset
|
560 Assert_That__ValidationPasses(req, army); |
12ac487af0ba
Re #395: Requirements can incorrectly allow based on common divisor
IBBoard <dev@ibboard.co.uk>
parents:
221
diff
changeset
|
561 AddUnitOfTypeToArmy(unitType1, army); |
12ac487af0ba
Re #395: Requirements can incorrectly allow based on common divisor
IBBoard <dev@ibboard.co.uk>
parents:
221
diff
changeset
|
562 Assert_That__ValidationPasses(req, army); |
12ac487af0ba
Re #395: Requirements can incorrectly allow based on common divisor
IBBoard <dev@ibboard.co.uk>
parents:
221
diff
changeset
|
563 AddUnitOfTypeToArmy(unitType1, army); |
12ac487af0ba
Re #395: Requirements can incorrectly allow based on common divisor
IBBoard <dev@ibboard.co.uk>
parents:
221
diff
changeset
|
564 Assert_That__ValidationFails(req, army, "Army must contain: 4 × " + unitType2.Name + " or " + unitType3.Name + " for every 2 × " + unitType1.Name + " (have 4 for 3)."); |
12ac487af0ba
Re #395: Requirements can incorrectly allow based on common divisor
IBBoard <dev@ibboard.co.uk>
parents:
221
diff
changeset
|
565 AddUnitOfTypeToArmy(unitType2, army); |
12ac487af0ba
Re #395: Requirements can incorrectly allow based on common divisor
IBBoard <dev@ibboard.co.uk>
parents:
221
diff
changeset
|
566 Assert_That__ValidationFails(req, army, "Army must contain: 4 × " + unitType2.Name + " or " + unitType3.Name + " for every 2 × " + unitType1.Name + " (have 5 for 3)."); |
223
fd51527f6d64
Re #395: Requirements can incorrectly allow based on common divisor
IBBoard <dev@ibboard.co.uk>
parents:
222
diff
changeset
|
567 AddUnitOfTypeToArmy(unitType2, army); |
fd51527f6d64
Re #395: Requirements can incorrectly allow based on common divisor
IBBoard <dev@ibboard.co.uk>
parents:
222
diff
changeset
|
568 Assert_That__ValidationFails(req, army, "Army must contain: 4 × " + unitType2.Name + " or " + unitType3.Name + " for every 2 × " + unitType1.Name + " (have 6 for 3)."); |
fd51527f6d64
Re #395: Requirements can incorrectly allow based on common divisor
IBBoard <dev@ibboard.co.uk>
parents:
222
diff
changeset
|
569 AddUnitsOfTypeToArmy(2, unitType2, army); |
222
12ac487af0ba
Re #395: Requirements can incorrectly allow based on common divisor
IBBoard <dev@ibboard.co.uk>
parents:
221
diff
changeset
|
570 Assert_That__ValidationPasses(req, army); |
12ac487af0ba
Re #395: Requirements can incorrectly allow based on common divisor
IBBoard <dev@ibboard.co.uk>
parents:
221
diff
changeset
|
571 } |
12ac487af0ba
Re #395: Requirements can incorrectly allow based on common divisor
IBBoard <dev@ibboard.co.uk>
parents:
221
diff
changeset
|
572 |
217
9bf34e88da89
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
214
diff
changeset
|
573 protected override UnitRequiresNUnitsForMUnitsRequirement CreateRequirement(UnitType requirementOn) |
9bf34e88da89
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
214
diff
changeset
|
574 { |
9bf34e88da89
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
214
diff
changeset
|
575 return new UnitRequiresNUnitsForMUnitsRequirement(requirementOn); |
9bf34e88da89
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
214
diff
changeset
|
576 } |
208
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
577 } |
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
578 } |
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
579 |