Mercurial > repos > IBDev-IBBoard.WarFoundry.API.Tests
annotate API/Factories/Requirement/UnitRequiresNUnitsForMUnitsRequirementFactoryTest.cs @ 201:43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
* Add tests on factory for different combinations of additive and non-additive requirements
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Fri, 23 Dec 2011 14:52:22 +0000 |
parents | 6a0a0e228e3c |
children | c323770e61c2 |
rev | line source |
---|---|
193
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
1 // This file (UnitUnitRequiresNUnitsForMUnitsRequirementFactoryTest.cs) is a part of the IBBoard.WarFoundry.API.Tests project and is copyright 2011 IBBoard |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
2 // |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
3 // The file and the library/program it is in are licensed and distributed, without warranty, under the GNU Affero GPL license, either version 3 of the License or (at your option) any later version. Please see COPYING for more information and the full license. |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
4 using System; |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
5 using NUnit.Framework; |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
6 using IBBoard.WarFoundry.API.Objects.Mock; |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
7 using NUnit.Framework.SyntaxHelpers; |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
8 using IBBoard.WarFoundry.API.Objects; |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
9 using IBBoard.WarFoundry.API.Objects.Requirement; |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
10 using IBBoard.WarFoundry.API.Factories.Mock; |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
11 |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
12 namespace IBBoard.WarFoundry.API.Factories.Requirement |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
13 { |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
14 [TestFixture()] |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
15 public class UnitUnitRequiresNUnitsForMUnitsRequirementFactoryTest |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
16 { |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
17 private static Race race; |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
18 private static string typeID1 = "unit1"; |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
19 private static string typeID2 = "unit2"; |
201
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
20 private static string typeID3 = "unit3"; |
193
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
21 private static UnitType unitType1; |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
22 private static UnitType unitType2; |
201
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
23 private static UnitType unitType3; |
193
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
24 private static MockRaceFactory raceFactory = new MockRaceFactory(); |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
25 |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
26 [TestFixtureSetUp()] |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
27 public void Setup() |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
28 { |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
29 race = new MockRace(); |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
30 unitType1 = new UnitType(typeID1, "Unit 1", race); |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
31 race.AddUnitType(unitType1); |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
32 unitType2 = new UnitType(typeID2, "Unit 2", race); |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
33 race.AddUnitType(unitType2); |
201
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
34 unitType3 = new UnitType(typeID3, "Unit 3", race); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
35 race.AddUnitType(unitType3); |
193
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
36 } |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
37 |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
38 [Test()] |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
39 public void TestCreatesRequirement() |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
40 { |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
41 UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory(); |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
42 Assert.That(factory.CreateRequirement(unitType2, typeID1, raceFactory), Is.Not.Null); |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
43 } |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
44 |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
45 [Test()] |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
46 public void TestCreatesCorrectRequirement() |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
47 { |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
48 UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory(); |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
49 UnitType unitType = new UnitType("testUnit", "Test Unit", race); |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
50 RequiresNUnitsForMUnitsRequirement expectedReq = new RequiresNUnitsForMUnitsRequirement(unitType); |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
51 expectedReq.AddUnitTypeRequirement(unitType1); |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
52 IRequirement req = factory.CreateRequirement(unitType, typeID1, raceFactory); |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
53 Assert.That(req, Is.EqualTo(expectedReq)); |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
54 } |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
55 |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
56 [Test()] |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
57 public void TestCreatesCorrectRequirementForTwoIDs() |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
58 { |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
59 UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory(); |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
60 UnitType unitType = new UnitType("testUnit", "Test Unit", race); |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
61 RequiresNUnitsForMUnitsRequirement expectedReq = new RequiresNUnitsForMUnitsRequirement(unitType); |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
62 expectedReq.AddUnitTypeRequirement(unitType1); |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
63 expectedReq.AddUnitTypeRequirement(unitType2); |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
64 IRequirement req = factory.CreateRequirement(unitType, typeID1 + "|" + typeID2, raceFactory); |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
65 Assert.That(req, Is.EqualTo(expectedReq)); |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
66 } |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
67 |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
68 [Test()] |
201
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
69 public void TestCreatesCorrectRequirementForThreeIDs() |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
70 { |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
71 UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory(); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
72 UnitType unitType = new UnitType("testUnit", "Test Unit", race); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
73 RequiresNUnitsForMUnitsRequirement expectedReq = new RequiresNUnitsForMUnitsRequirement(unitType); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
74 expectedReq.AddUnitTypeRequirement(unitType1); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
75 expectedReq.AddUnitTypeRequirement(unitType2); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
76 expectedReq.AddUnitTypeRequirement(unitType3); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
77 IRequirement req = factory.CreateRequirement(unitType, typeID1 + "|" + typeID2 + "|" + typeID3, raceFactory); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
78 Assert.That(req, Is.EqualTo(expectedReq)); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
79 } |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
80 |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
81 [Test()] |
193
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
82 public void TestCreatesCorrectRequirementWithNumber() |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
83 { |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
84 UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory(); |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
85 UnitType unitType = new UnitType("testUnit", "Test Unit", race); |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
86 RequiresNUnitsForMUnitsRequirement expectedReq = new RequiresNUnitsForMUnitsRequirement(unitType); |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
87 expectedReq.AddUnitTypeRequirement(unitType1, 2); |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
88 IRequirement req = factory.CreateRequirement(unitType, typeID1 + ":2", raceFactory); |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
89 Assert.That(req, Is.EqualTo(expectedReq)); |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
90 } |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
91 |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
92 [Test()] |
194
f1f4df654a91
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
193
diff
changeset
|
93 public void TestCreatesCorrectRequirementWithTwoNumbers() |
f1f4df654a91
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
193
diff
changeset
|
94 { |
f1f4df654a91
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
193
diff
changeset
|
95 UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory(); |
f1f4df654a91
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
193
diff
changeset
|
96 UnitType unitType = new UnitType("testUnit", "Test Unit", race); |
f1f4df654a91
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
193
diff
changeset
|
97 RequiresNUnitsForMUnitsRequirement expectedReq = new RequiresNUnitsForMUnitsRequirement(unitType); |
f1f4df654a91
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
193
diff
changeset
|
98 expectedReq.AddUnitTypeRequirement(unitType1, 2, 3); |
f1f4df654a91
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
193
diff
changeset
|
99 IRequirement req = factory.CreateRequirement(unitType, typeID1 + ":2;3", raceFactory); |
f1f4df654a91
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
193
diff
changeset
|
100 Assert.That(req, Is.EqualTo(expectedReq)); |
f1f4df654a91
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
193
diff
changeset
|
101 } |
f1f4df654a91
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
193
diff
changeset
|
102 |
f1f4df654a91
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
193
diff
changeset
|
103 [Test()] |
193
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
104 public void TestCreatesCorrectRequirementForTwoIDsWithTwoNumbers() |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
105 { |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
106 UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory(); |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
107 UnitType unitType = new UnitType("testUnit", "Test Unit", race); |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
108 RequiresNUnitsForMUnitsRequirement expectedReq = new RequiresNUnitsForMUnitsRequirement(unitType); |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
109 expectedReq.AddUnitTypeRequirement(unitType1, 2); |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
110 expectedReq.AddUnitTypeRequirement(unitType2, 3); |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
111 IRequirement req = factory.CreateRequirement(unitType, typeID1 + ":2|" + typeID2 + ":3", raceFactory); |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
112 Assert.That(req, Is.EqualTo(expectedReq)); |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
113 } |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
114 |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
115 [Test()] |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
116 public void TestCreatesCorrectRequirementForTwoIDsWithOneNumber() |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
117 { |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
118 UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory(); |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
119 UnitType unitType = new UnitType("testUnit", "Test Unit", race); |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
120 RequiresNUnitsForMUnitsRequirement expectedReq = new RequiresNUnitsForMUnitsRequirement(unitType); |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
121 expectedReq.AddUnitTypeRequirement(unitType1, 2); |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
122 expectedReq.AddUnitTypeRequirement(unitType2); |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
123 IRequirement req = factory.CreateRequirement(unitType, typeID1 + ":2|" + typeID2, raceFactory); |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
124 Assert.That(req, Is.EqualTo(expectedReq)); |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
125 } |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
126 |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
127 [Test()] |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
128 public void TestCreatesCorrectRequirementForTwoIDsWithOtherNumber() |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
129 { |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
130 UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory(); |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
131 UnitType unitType = new UnitType("testUnit", "Test Unit", race); |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
132 RequiresNUnitsForMUnitsRequirement expectedReq = new RequiresNUnitsForMUnitsRequirement(unitType); |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
133 expectedReq.AddUnitTypeRequirement(unitType1); |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
134 expectedReq.AddUnitTypeRequirement(unitType2, 3); |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
135 IRequirement req = factory.CreateRequirement(unitType, typeID1 + "|" + typeID2 + ":3", raceFactory); |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
136 Assert.That(req, Is.EqualTo(expectedReq)); |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
137 } |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
138 |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
139 [Test()] |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
140 [ExpectedException(typeof(InvalidRequirementException), ExpectedMessage="Invalid unit type 'fibble' for 'Requires N units for M units' requirement")] |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
141 public void TestExceptionsForInvalidID() |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
142 { |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
143 UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory(); |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
144 UnitType unitType = new UnitType("testUnit", "Test Unit", race); |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
145 factory.CreateRequirement(unitType, "fibble", raceFactory); |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
146 } |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
147 |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
148 [Test()] |
200
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
149 [ExpectedException(typeof(InvalidRequirementException), ExpectedMessage="Invalid allowed amount 'a' for unit types 'unit1' for 'Requires N units for M units' requirement")] |
193
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
150 public void TestExceptionsForInvalidNumber() |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
151 { |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
152 UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory(); |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
153 UnitType unitType = new UnitType("testUnit", "Test Unit", race); |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
154 factory.CreateRequirement(unitType, typeID1+":a", raceFactory); |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
155 } |
194
f1f4df654a91
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
193
diff
changeset
|
156 |
f1f4df654a91
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
193
diff
changeset
|
157 [Test()] |
200
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
158 [ExpectedException(typeof(InvalidRequirementException), ExpectedMessage="Invalid allowed amount 'a' for unit types 'unit1' for 'Requires N units for M units' requirement")] |
194
f1f4df654a91
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
193
diff
changeset
|
159 public void TestExceptionsForInvalidAllowedNumber() |
f1f4df654a91
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
193
diff
changeset
|
160 { |
f1f4df654a91
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
193
diff
changeset
|
161 UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory(); |
f1f4df654a91
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
193
diff
changeset
|
162 UnitType unitType = new UnitType("testUnit", "Test Unit", race); |
f1f4df654a91
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
193
diff
changeset
|
163 factory.CreateRequirement(unitType, typeID1 + ":3;a", raceFactory); |
f1f4df654a91
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
193
diff
changeset
|
164 } |
f1f4df654a91
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
193
diff
changeset
|
165 |
f1f4df654a91
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
193
diff
changeset
|
166 [Test()] |
200
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
167 [ExpectedException(typeof(InvalidRequirementException), ExpectedMessage="Invalid minimum amount 'a' for unit types 'unit1' for 'Requires N units for M units' requirement")] |
194
f1f4df654a91
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
193
diff
changeset
|
168 public void TestExceptionsForInvalidMinimumNumber() |
f1f4df654a91
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
193
diff
changeset
|
169 { |
f1f4df654a91
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
193
diff
changeset
|
170 UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory(); |
f1f4df654a91
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
193
diff
changeset
|
171 UnitType unitType = new UnitType("testUnit", "Test Unit", race); |
f1f4df654a91
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
193
diff
changeset
|
172 factory.CreateRequirement(unitType, typeID1 + ":a;3", raceFactory); |
f1f4df654a91
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
193
diff
changeset
|
173 } |
200
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
174 |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
175 [Test()] |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
176 public void TestCreatesCorrectAdditiveRequirement() |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
177 { |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
178 UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory(); |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
179 UnitType unitType = new UnitType("testUnit", "Test Unit", race); |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
180 RequiresNUnitsForMUnitsRequirement expectedReq = new RequiresNUnitsForMUnitsRequirement(unitType); |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
181 expectedReq.AddUnitTypeRequirement(unitType1, unitType2); |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
182 IRequirement req = factory.CreateRequirement(unitType, typeID1 + ";" + typeID2, raceFactory); |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
183 Assert.That(req, Is.EqualTo(expectedReq)); |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
184 } |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
185 |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
186 [Test()] |
201
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
187 public void TestCreatesCorrectTripleAdditiveRequirement() |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
188 { |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
189 UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory(); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
190 UnitType unitType = new UnitType("testUnit", "Test Unit", race); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
191 RequiresNUnitsForMUnitsRequirement expectedReq = new RequiresNUnitsForMUnitsRequirement(unitType); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
192 expectedReq.AddUnitTypeRequirement(unitType1, unitType2, unitType3); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
193 IRequirement req = factory.CreateRequirement(unitType, typeID1 + ";" + typeID2 + ";" + typeID3, raceFactory); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
194 Assert.That(req, Is.EqualTo(expectedReq)); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
195 } |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
196 |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
197 [Test()] |
200
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
198 public void TestCreatesCorrectAdditiveRequirementForTwoIDs() |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
199 { |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
200 UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory(); |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
201 UnitType unitType = new UnitType("testUnit", "Test Unit", race); |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
202 RequiresNUnitsForMUnitsRequirement expectedReq = new RequiresNUnitsForMUnitsRequirement(unitType); |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
203 expectedReq.AddUnitTypeRequirement(unitType1, unitType2); |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
204 expectedReq.AddUnitTypeRequirement(unitType2); |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
205 IRequirement req = factory.CreateRequirement(unitType, typeID1 + ";" + typeID2 + "|" + typeID2, raceFactory); |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
206 Assert.That(req, Is.EqualTo(expectedReq)); |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
207 } |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
208 |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
209 [Test()] |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
210 public void TestCreatesCorrectAdditiveRequirementWithNumber() |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
211 { |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
212 UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory(); |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
213 UnitType unitType = new UnitType("testUnit", "Test Unit", race); |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
214 RequiresNUnitsForMUnitsRequirement expectedReq = new RequiresNUnitsForMUnitsRequirement(unitType); |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
215 expectedReq.AddUnitTypeRequirement(2, unitType1, unitType2); |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
216 IRequirement req = factory.CreateRequirement(unitType, typeID1 + ";" + typeID2 + ":2", raceFactory); |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
217 Assert.That(req, Is.EqualTo(expectedReq)); |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
218 } |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
219 |
201
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
220 [Test()] |
200
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
221 public void TestCreatesCorrectAdditiveRequirementWithTwoNumbers() |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
222 { |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
223 UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory(); |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
224 UnitType unitType = new UnitType("testUnit", "Test Unit", race); |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
225 RequiresNUnitsForMUnitsRequirement expectedReq = new RequiresNUnitsForMUnitsRequirement(unitType); |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
226 expectedReq.AddUnitTypeRequirement(2, 3, unitType1, unitType2); |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
227 IRequirement req = factory.CreateRequirement(unitType, typeID1 + ";" + typeID2 + ":2;3", raceFactory); |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
228 Assert.That(req, Is.EqualTo(expectedReq)); |
201
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
229 } |
200
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
230 |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
231 [Test()] |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
232 public void TestCreatesCorrectAdditiveRequirementForTwoIDsWithTwoNumbers() |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
233 { |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
234 UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory(); |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
235 UnitType unitType = new UnitType("testUnit", "Test Unit", race); |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
236 RequiresNUnitsForMUnitsRequirement expectedReq = new RequiresNUnitsForMUnitsRequirement(unitType); |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
237 expectedReq.AddUnitTypeRequirement(2, unitType1, unitType2); |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
238 expectedReq.AddUnitTypeRequirement(3, unitType2, unitType1); |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
239 IRequirement req = factory.CreateRequirement(unitType, typeID1 + ";" + typeID2 + ":2|" + typeID2 + ";" + typeID1 + ":3", raceFactory); |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
240 Assert.That(req, Is.EqualTo(expectedReq)); |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
241 } |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
242 |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
243 [Test()] |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
244 public void TestCreatesCorrectAdditiveRequirementForTwoIDsWithOneNumber() |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
245 { |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
246 UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory(); |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
247 UnitType unitType = new UnitType("testUnit", "Test Unit", race); |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
248 RequiresNUnitsForMUnitsRequirement expectedReq = new RequiresNUnitsForMUnitsRequirement(unitType); |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
249 expectedReq.AddUnitTypeRequirement(2, unitType1, unitType2); |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
250 expectedReq.AddUnitTypeRequirement(unitType2, unitType1); |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
251 IRequirement req = factory.CreateRequirement(unitType, typeID1 + ";" + typeID2 + ":2|" + typeID2 + ";" + typeID1, raceFactory); |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
252 Assert.That(req, Is.EqualTo(expectedReq)); |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
253 } |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
254 |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
255 [Test()] |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
256 public void TestCreatesCorrectAdditiveRequirementForTwoIDsWithOtherNumber() |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
257 { |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
258 UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory(); |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
259 UnitType unitType = new UnitType("testUnit", "Test Unit", race); |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
260 RequiresNUnitsForMUnitsRequirement expectedReq = new RequiresNUnitsForMUnitsRequirement(unitType); |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
261 expectedReq.AddUnitTypeRequirement(unitType1, unitType2); |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
262 expectedReq.AddUnitTypeRequirement(3, unitType2, unitType1); |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
263 IRequirement req = factory.CreateRequirement(unitType, typeID1 + ";" + typeID2 + "|" + typeID2 + ";" + typeID1 + ":3", raceFactory); |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
264 Assert.That(req, Is.EqualTo(expectedReq)); |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
265 } |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
266 |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
267 [Test()] |
201
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
268 public void TestCreatesCorrectRequirementForOneIDAndOneAdditive() |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
269 { |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
270 UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory(); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
271 UnitType unitType = new UnitType("testUnit", "Test Unit", race); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
272 RequiresNUnitsForMUnitsRequirement expectedReq = new RequiresNUnitsForMUnitsRequirement(unitType); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
273 expectedReq.AddUnitTypeRequirement(unitType1, unitType2); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
274 expectedReq.AddUnitTypeRequirement(unitType2); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
275 IRequirement req = factory.CreateRequirement(unitType, typeID1 + ";" + typeID2 + "|" + typeID2, raceFactory); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
276 Assert.That(req, Is.EqualTo(expectedReq)); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
277 } |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
278 |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
279 [Test()] |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
280 public void TestCreatesCorrectRequirementForOneIDAndOneAdditiveInOtherOrder() |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
281 { |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
282 UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory(); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
283 UnitType unitType = new UnitType("testUnit", "Test Unit", race); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
284 RequiresNUnitsForMUnitsRequirement expectedReq = new RequiresNUnitsForMUnitsRequirement(unitType); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
285 expectedReq.AddUnitTypeRequirement(unitType2); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
286 expectedReq.AddUnitTypeRequirement(unitType1, unitType2); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
287 IRequirement req = factory.CreateRequirement(unitType, typeID2 + "|" + typeID1 + ";" + typeID2, raceFactory); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
288 Assert.That(req, Is.EqualTo(expectedReq)); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
289 } |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
290 |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
291 [Test()] |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
292 public void TestCreatesCorrectRequirementForOneIDWithNumberAndOneAdditive() |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
293 { |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
294 UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory(); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
295 UnitType unitType = new UnitType("testUnit", "Test Unit", race); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
296 RequiresNUnitsForMUnitsRequirement expectedReq = new RequiresNUnitsForMUnitsRequirement(unitType); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
297 expectedReq.AddUnitTypeRequirement(unitType1, unitType2); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
298 expectedReq.AddUnitTypeRequirement(unitType2, 3); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
299 IRequirement req = factory.CreateRequirement(unitType, typeID1 + ";" + typeID2 + "|" + typeID2 + ":3", raceFactory); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
300 Assert.That(req, Is.EqualTo(expectedReq)); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
301 } |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
302 |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
303 [Test()] |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
304 public void TestCreatesCorrectRequirementForOneIDWithNumberAndOneAdditiveInOtherOrder() |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
305 { |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
306 UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory(); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
307 UnitType unitType = new UnitType("testUnit", "Test Unit", race); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
308 RequiresNUnitsForMUnitsRequirement expectedReq = new RequiresNUnitsForMUnitsRequirement(unitType); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
309 expectedReq.AddUnitTypeRequirement(unitType2, 3); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
310 expectedReq.AddUnitTypeRequirement(unitType1, unitType2); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
311 IRequirement req = factory.CreateRequirement(unitType, typeID2 + ":3|" + typeID1 + ";" + typeID2, raceFactory); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
312 Assert.That(req, Is.EqualTo(expectedReq)); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
313 } |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
314 |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
315 [Test()] |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
316 public void TestCreatesCorrectRequirementForOneIDAndOneAdditiveWithNumber() |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
317 { |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
318 UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory(); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
319 UnitType unitType = new UnitType("testUnit", "Test Unit", race); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
320 RequiresNUnitsForMUnitsRequirement expectedReq = new RequiresNUnitsForMUnitsRequirement(unitType); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
321 expectedReq.AddUnitTypeRequirement(3, unitType1, unitType2); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
322 expectedReq.AddUnitTypeRequirement(unitType2); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
323 IRequirement req = factory.CreateRequirement(unitType, typeID1 + ";" + typeID2 + ":3|" + typeID2, raceFactory); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
324 Assert.That(req, Is.EqualTo(expectedReq)); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
325 } |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
326 |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
327 [Test()] |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
328 public void TestCreatesCorrectRequirementForOneIDAndOneAdditiveWithNumberInOtherOrder() |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
329 { |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
330 UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory(); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
331 UnitType unitType = new UnitType("testUnit", "Test Unit", race); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
332 RequiresNUnitsForMUnitsRequirement expectedReq = new RequiresNUnitsForMUnitsRequirement(unitType); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
333 expectedReq.AddUnitTypeRequirement(unitType2); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
334 expectedReq.AddUnitTypeRequirement(3, unitType1, unitType2); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
335 IRequirement req = factory.CreateRequirement(unitType, typeID2 + "|" + typeID1 + ";" + typeID2 + ":3", raceFactory); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
336 Assert.That(req, Is.EqualTo(expectedReq)); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
337 } |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
338 |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
339 [Test()] |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
340 public void TestCreatesCorrectRequirementForOneIDWithMinAndAllowedAndOneAdditive() |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
341 { |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
342 UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory(); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
343 UnitType unitType = new UnitType("testUnit", "Test Unit", race); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
344 RequiresNUnitsForMUnitsRequirement expectedReq = new RequiresNUnitsForMUnitsRequirement(unitType); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
345 expectedReq.AddUnitTypeRequirement(unitType1, unitType2); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
346 expectedReq.AddUnitTypeRequirement(3, 2, unitType2); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
347 IRequirement req = factory.CreateRequirement(unitType, typeID1 + ";" + typeID2 + "|" + typeID2 + ":3;2", raceFactory); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
348 Assert.That(req, Is.EqualTo(expectedReq)); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
349 } |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
350 |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
351 [Test()] |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
352 public void TestCreatesCorrectRequirementForOneIDWithMinAndAllowedAndOneAdditiveInOtherOrder() |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
353 { |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
354 UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory(); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
355 UnitType unitType = new UnitType("testUnit", "Test Unit", race); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
356 RequiresNUnitsForMUnitsRequirement expectedReq = new RequiresNUnitsForMUnitsRequirement(unitType); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
357 expectedReq.AddUnitTypeRequirement(3, 2, unitType2); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
358 expectedReq.AddUnitTypeRequirement(unitType1, unitType2); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
359 IRequirement req = factory.CreateRequirement(unitType, typeID2 + ":3;2|" + typeID1 + ";" + typeID2, raceFactory); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
360 Assert.That(req, Is.EqualTo(expectedReq)); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
361 } |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
362 |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
363 [Test()] |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
364 public void TestCreatesCorrectRequirementForOneIDWithNumberAndOneAdditiveWithMinAndAllowed() |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
365 { |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
366 UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory(); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
367 UnitType unitType = new UnitType("testUnit", "Test Unit", race); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
368 RequiresNUnitsForMUnitsRequirement expectedReq = new RequiresNUnitsForMUnitsRequirement(unitType); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
369 expectedReq.AddUnitTypeRequirement(3, 2, unitType1, unitType2); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
370 expectedReq.AddUnitTypeRequirement(unitType2, 3); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
371 IRequirement req = factory.CreateRequirement(unitType, typeID1 + ";" + typeID2 + ":3;2|" + typeID2 + ":3", raceFactory); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
372 Assert.That(req, Is.EqualTo(expectedReq)); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
373 } |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
374 |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
375 [Test()] |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
376 public void TestCreatesCorrectRequirementForOneIDWithNumberAndOneAdditiveWithMinAndAllowedInOtherOrder() |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
377 { |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
378 UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory(); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
379 UnitType unitType = new UnitType("testUnit", "Test Unit", race); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
380 RequiresNUnitsForMUnitsRequirement expectedReq = new RequiresNUnitsForMUnitsRequirement(unitType); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
381 expectedReq.AddUnitTypeRequirement(unitType2, 3); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
382 expectedReq.AddUnitTypeRequirement(3, 2, unitType1, unitType2); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
383 IRequirement req = factory.CreateRequirement(unitType, typeID2 + ":3|" + typeID1 + ";" + typeID2 + ":3;2", raceFactory); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
384 Assert.That(req, Is.EqualTo(expectedReq)); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
385 } |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
386 |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
387 [Test()] |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
388 public void TestCreatesCorrectRequirementForOneIDWithMinAndAllowedAndOneAdditiveWithNumber() |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
389 { |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
390 UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory(); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
391 UnitType unitType = new UnitType("testUnit", "Test Unit", race); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
392 RequiresNUnitsForMUnitsRequirement expectedReq = new RequiresNUnitsForMUnitsRequirement(unitType); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
393 expectedReq.AddUnitTypeRequirement(3, unitType1, unitType2); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
394 expectedReq.AddUnitTypeRequirement(unitType2, 3, 2); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
395 IRequirement req = factory.CreateRequirement(unitType, typeID1 + ";" + typeID2 + ":3|" + typeID2 + ":3;2", raceFactory); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
396 Assert.That(req, Is.EqualTo(expectedReq)); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
397 } |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
398 |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
399 [Test()] |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
400 public void TestCreatesCorrectRequirementForOneIDWithMinAndAllowedAndOneAdditiveWithNumberInOtherOrder() |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
401 { |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
402 UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory(); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
403 UnitType unitType = new UnitType("testUnit", "Test Unit", race); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
404 RequiresNUnitsForMUnitsRequirement expectedReq = new RequiresNUnitsForMUnitsRequirement(unitType); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
405 expectedReq.AddUnitTypeRequirement(unitType2, 3, 2); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
406 expectedReq.AddUnitTypeRequirement(3, unitType1, unitType2); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
407 IRequirement req = factory.CreateRequirement(unitType, typeID2 + ":3;2|" + typeID1 + ";" + typeID2 + ":3", raceFactory); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
408 Assert.That(req, Is.EqualTo(expectedReq)); |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
409 } |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
410 |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
411 [Test()] |
200
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
412 [ExpectedException(typeof(InvalidRequirementException), ExpectedMessage="Invalid unit type 'fibble' for 'Requires N units for M units' requirement")] |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
413 public void TestExceptionsForAdditiveRequirementWithInvalidID() |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
414 { |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
415 UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory(); |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
416 UnitType unitType = new UnitType("testUnit", "Test Unit", race); |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
417 factory.CreateRequirement(unitType, "fibble;" + typeID1, raceFactory); |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
418 } |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
419 |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
420 [Test()] |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
421 [ExpectedException(typeof(InvalidRequirementException), ExpectedMessage="Invalid unit type 'fibble' for 'Requires N units for M units' requirement")] |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
422 public void TestExceptionsForAdditiveRequirementWithOtherInvalidID() |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
423 { |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
424 UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory(); |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
425 UnitType unitType = new UnitType("testUnit", "Test Unit", race); |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
426 factory.CreateRequirement(unitType, typeID1 + ";fibble", raceFactory); |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
427 } |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
428 |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
429 [Test()] |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
430 [ExpectedException(typeof(InvalidRequirementException), ExpectedMessage="Invalid allowed amount 'a' for unit types 'unit1;unit2' for 'Requires N units for M units' requirement")] |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
431 public void TestExceptionsForAdditiveRequirementWithInvalidNumber() |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
432 { |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
433 UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory(); |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
434 UnitType unitType = new UnitType("testUnit", "Test Unit", race); |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
435 factory.CreateRequirement(unitType, typeID1 + ";" + typeID2 + ":a", raceFactory); |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
436 } |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
437 |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
438 [Test()] |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
439 [ExpectedException(typeof(InvalidRequirementException), ExpectedMessage="Invalid allowed amount 'a' for unit types 'unit1;unit2' for 'Requires N units for M units' requirement")] |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
440 public void TestExceptionsForAdditiveRequirementWithInvalidAllowedNumber() |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
441 { |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
442 UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory(); |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
443 UnitType unitType = new UnitType("testUnit", "Test Unit", race); |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
444 factory.CreateRequirement(unitType, typeID1 + ";" + typeID2 + ":3;a", raceFactory); |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
445 } |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
446 |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
447 [Test()] |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
448 [ExpectedException(typeof(InvalidRequirementException), ExpectedMessage="Invalid minimum amount 'a' for unit types 'unit1;unit2' for 'Requires N units for M units' requirement")] |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
449 public void TestExceptionsForAdditiveRequirementWithInvalidMinimumNumber() |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
450 { |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
451 UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory(); |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
452 UnitType unitType = new UnitType("testUnit", "Test Unit", race); |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
453 factory.CreateRequirement(unitType, typeID1 + ";" + typeID2 + ":a;3", raceFactory); |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
454 } |
193
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
455 } |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
456 } |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
457 |