Mercurial > repos > IBDev-IBBoard.WarFoundry.API.Tests
annotate API/Factories/Requirement/UnitRequiresNUnitsForMUnitsRequirementFactoryTest.cs @ 239:370bec16a364 default tip
Add initial testing for equipment with type (incomplete)
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sun, 16 Oct 2016 20:29:35 +0100 |
parents | e173c5512067 |
children |
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 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
|
8 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
|
9 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
|
10 |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
11 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
|
12 { |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
13 [TestFixture()] |
208
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
201
diff
changeset
|
14 public class UnitRequiresNUnitsForMUnitsRequirementFactoryTest |
193
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
15 { |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
16 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
|
17 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
|
18 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
|
19 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
|
20 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
|
21 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
|
22 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
|
23 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
|
24 |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
25 [TestFixtureSetUp()] |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
26 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
|
27 { |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
28 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
|
29 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
|
30 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
|
31 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
|
32 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
|
33 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
|
34 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
|
35 } |
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 [Test()] |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
38 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
|
39 { |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
40 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
|
41 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
|
42 } |
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 [Test()] |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
45 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
|
46 { |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
47 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
|
48 UnitType unitType = new UnitType("testUnit", "Test Unit", race); |
208
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
201
diff
changeset
|
49 UnitRequiresNUnitsForMUnitsRequirement expectedReq = new UnitRequiresNUnitsForMUnitsRequirement(unitType); |
193
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
50 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
|
51 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
|
52 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
|
53 } |
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 [Test()] |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
56 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
|
57 { |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
58 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
|
59 UnitType unitType = new UnitType("testUnit", "Test Unit", race); |
208
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
201
diff
changeset
|
60 UnitRequiresNUnitsForMUnitsRequirement expectedReq = new UnitRequiresNUnitsForMUnitsRequirement(unitType); |
193
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
61 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
|
62 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
|
63 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
|
64 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
|
65 } |
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 [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
|
68 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
|
69 { |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
70 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
|
71 UnitType unitType = new UnitType("testUnit", "Test Unit", race); |
208
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
201
diff
changeset
|
72 UnitRequiresNUnitsForMUnitsRequirement expectedReq = new UnitRequiresNUnitsForMUnitsRequirement(unitType); |
201
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
73 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
|
74 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
|
75 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
|
76 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
|
77 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
|
78 } |
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 [Test()] |
193
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
81 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
|
82 { |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
83 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
|
84 UnitType unitType = new UnitType("testUnit", "Test Unit", race); |
208
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
201
diff
changeset
|
85 UnitRequiresNUnitsForMUnitsRequirement expectedReq = new UnitRequiresNUnitsForMUnitsRequirement(unitType); |
193
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
86 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
|
87 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
|
88 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
|
89 } |
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 [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
|
92 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
|
93 { |
f1f4df654a91
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
193
diff
changeset
|
94 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
|
95 UnitType unitType = new UnitType("testUnit", "Test Unit", race); |
208
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
201
diff
changeset
|
96 UnitRequiresNUnitsForMUnitsRequirement expectedReq = new UnitRequiresNUnitsForMUnitsRequirement(unitType); |
194
f1f4df654a91
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
193
diff
changeset
|
97 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
|
98 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
|
99 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
|
100 } |
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 [Test()] |
193
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
103 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
|
104 { |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
105 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
|
106 UnitType unitType = new UnitType("testUnit", "Test Unit", race); |
208
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
201
diff
changeset
|
107 UnitRequiresNUnitsForMUnitsRequirement expectedReq = new UnitRequiresNUnitsForMUnitsRequirement(unitType); |
193
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
108 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
|
109 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
|
110 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
|
111 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
|
112 } |
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 [Test()] |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
115 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
|
116 { |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
117 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
|
118 UnitType unitType = new UnitType("testUnit", "Test Unit", race); |
208
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
201
diff
changeset
|
119 UnitRequiresNUnitsForMUnitsRequirement expectedReq = new UnitRequiresNUnitsForMUnitsRequirement(unitType); |
193
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
120 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
|
121 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
|
122 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
|
123 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
|
124 } |
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 [Test()] |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
127 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
|
128 { |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
129 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
|
130 UnitType unitType = new UnitType("testUnit", "Test Unit", race); |
208
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
201
diff
changeset
|
131 UnitRequiresNUnitsForMUnitsRequirement expectedReq = new UnitRequiresNUnitsForMUnitsRequirement(unitType); |
193
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
132 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
|
133 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
|
134 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
|
135 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
|
136 } |
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 [Test()] |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
139 [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
|
140 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
|
141 { |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
142 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
|
143 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
|
144 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
|
145 } |
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 [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
|
148 [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
|
149 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
|
150 { |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
151 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
|
152 UnitType unitType = new UnitType("testUnit", "Test Unit", race); |
208
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
201
diff
changeset
|
153 factory.CreateRequirement(unitType, typeID1 + ":a", raceFactory); |
193
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
154 } |
194
f1f4df654a91
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
193
diff
changeset
|
155 |
f1f4df654a91
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
193
diff
changeset
|
156 [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
|
157 [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
|
158 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
|
159 { |
f1f4df654a91
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
193
diff
changeset
|
160 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
|
161 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
|
162 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
|
163 } |
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 [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
|
166 [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
|
167 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
|
168 { |
f1f4df654a91
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
193
diff
changeset
|
169 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
|
170 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
|
171 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
|
172 } |
200
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
173 |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
174 [Test()] |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
175 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
|
176 { |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
177 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
|
178 UnitType unitType = new UnitType("testUnit", "Test Unit", race); |
208
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
201
diff
changeset
|
179 UnitRequiresNUnitsForMUnitsRequirement expectedReq = new UnitRequiresNUnitsForMUnitsRequirement(unitType); |
200
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
180 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
|
181 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
|
182 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
|
183 } |
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 [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
|
186 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
|
187 { |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
188 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
|
189 UnitType unitType = new UnitType("testUnit", "Test Unit", race); |
208
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
201
diff
changeset
|
190 UnitRequiresNUnitsForMUnitsRequirement expectedReq = new UnitRequiresNUnitsForMUnitsRequirement(unitType); |
201
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
191 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
|
192 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
|
193 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
|
194 } |
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 [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
|
197 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
|
198 { |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
199 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
|
200 UnitType unitType = new UnitType("testUnit", "Test Unit", race); |
208
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
201
diff
changeset
|
201 UnitRequiresNUnitsForMUnitsRequirement expectedReq = new UnitRequiresNUnitsForMUnitsRequirement(unitType); |
200
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
202 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
|
203 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
|
204 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
|
205 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
|
206 } |
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 [Test()] |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
209 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
|
210 { |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
211 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
|
212 UnitType unitType = new UnitType("testUnit", "Test Unit", race); |
208
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
201
diff
changeset
|
213 UnitRequiresNUnitsForMUnitsRequirement expectedReq = new UnitRequiresNUnitsForMUnitsRequirement(unitType); |
200
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
214 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
|
215 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
|
216 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
|
217 } |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
218 |
201
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
219 [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
|
220 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
|
221 { |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
222 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
|
223 UnitType unitType = new UnitType("testUnit", "Test Unit", race); |
208
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
201
diff
changeset
|
224 UnitRequiresNUnitsForMUnitsRequirement expectedReq = new UnitRequiresNUnitsForMUnitsRequirement(unitType); |
200
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
225 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
|
226 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
|
227 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
|
228 } |
200
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
229 |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
230 [Test()] |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
231 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
|
232 { |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
233 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
|
234 UnitType unitType = new UnitType("testUnit", "Test Unit", race); |
208
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
201
diff
changeset
|
235 UnitRequiresNUnitsForMUnitsRequirement expectedReq = new UnitRequiresNUnitsForMUnitsRequirement(unitType); |
200
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
236 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
|
237 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
|
238 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
|
239 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
|
240 } |
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 [Test()] |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
243 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
|
244 { |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
245 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
|
246 UnitType unitType = new UnitType("testUnit", "Test Unit", race); |
208
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
201
diff
changeset
|
247 UnitRequiresNUnitsForMUnitsRequirement expectedReq = new UnitRequiresNUnitsForMUnitsRequirement(unitType); |
200
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
248 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
|
249 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
|
250 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
|
251 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
|
252 } |
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 [Test()] |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
255 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
|
256 { |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
257 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
|
258 UnitType unitType = new UnitType("testUnit", "Test Unit", race); |
208
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
201
diff
changeset
|
259 UnitRequiresNUnitsForMUnitsRequirement expectedReq = new UnitRequiresNUnitsForMUnitsRequirement(unitType); |
200
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
260 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
|
261 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
|
262 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
|
263 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
|
264 } |
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 [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
|
267 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
|
268 { |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
269 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
|
270 UnitType unitType = new UnitType("testUnit", "Test Unit", race); |
208
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
201
diff
changeset
|
271 UnitRequiresNUnitsForMUnitsRequirement expectedReq = new UnitRequiresNUnitsForMUnitsRequirement(unitType); |
201
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
272 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
|
273 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
|
274 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
|
275 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
|
276 } |
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 [Test()] |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
279 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
|
280 { |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
281 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
|
282 UnitType unitType = new UnitType("testUnit", "Test Unit", race); |
208
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
201
diff
changeset
|
283 UnitRequiresNUnitsForMUnitsRequirement expectedReq = new UnitRequiresNUnitsForMUnitsRequirement(unitType); |
201
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
284 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
|
285 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
|
286 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
|
287 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
|
288 } |
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 [Test()] |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
291 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
|
292 { |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
293 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
|
294 UnitType unitType = new UnitType("testUnit", "Test Unit", race); |
208
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
201
diff
changeset
|
295 UnitRequiresNUnitsForMUnitsRequirement expectedReq = new UnitRequiresNUnitsForMUnitsRequirement(unitType); |
201
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
296 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
|
297 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
|
298 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
|
299 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
|
300 } |
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 [Test()] |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
303 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
|
304 { |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
305 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
|
306 UnitType unitType = new UnitType("testUnit", "Test Unit", race); |
208
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
201
diff
changeset
|
307 UnitRequiresNUnitsForMUnitsRequirement expectedReq = new UnitRequiresNUnitsForMUnitsRequirement(unitType); |
201
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
308 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
|
309 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
|
310 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
|
311 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
|
312 } |
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 [Test()] |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
315 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
|
316 { |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
317 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
|
318 UnitType unitType = new UnitType("testUnit", "Test Unit", race); |
208
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
201
diff
changeset
|
319 UnitRequiresNUnitsForMUnitsRequirement expectedReq = new UnitRequiresNUnitsForMUnitsRequirement(unitType); |
201
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
320 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
|
321 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
|
322 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
|
323 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
|
324 } |
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 [Test()] |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
327 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
|
328 { |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
329 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
|
330 UnitType unitType = new UnitType("testUnit", "Test Unit", race); |
208
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
201
diff
changeset
|
331 UnitRequiresNUnitsForMUnitsRequirement expectedReq = new UnitRequiresNUnitsForMUnitsRequirement(unitType); |
201
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
332 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
|
333 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
|
334 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
|
335 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
|
336 } |
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 [Test()] |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
339 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
|
340 { |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
341 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
|
342 UnitType unitType = new UnitType("testUnit", "Test Unit", race); |
208
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
201
diff
changeset
|
343 UnitRequiresNUnitsForMUnitsRequirement expectedReq = new UnitRequiresNUnitsForMUnitsRequirement(unitType); |
201
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
344 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
|
345 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
|
346 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
|
347 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
|
348 } |
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 [Test()] |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
351 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
|
352 { |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
353 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
|
354 UnitType unitType = new UnitType("testUnit", "Test Unit", race); |
208
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
201
diff
changeset
|
355 UnitRequiresNUnitsForMUnitsRequirement expectedReq = new UnitRequiresNUnitsForMUnitsRequirement(unitType); |
201
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
356 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
|
357 expectedReq.AddUnitTypeRequirement(unitType1, unitType2); |
208
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
201
diff
changeset
|
358 IRequirement req = factory.CreateRequirement(unitType, typeID2 + ":3;2|" + typeID1 + ";" + typeID2, raceFactory); |
201
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
359 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
|
360 } |
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 [Test()] |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
363 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
|
364 { |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
365 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
|
366 UnitType unitType = new UnitType("testUnit", "Test Unit", race); |
208
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
201
diff
changeset
|
367 UnitRequiresNUnitsForMUnitsRequirement expectedReq = new UnitRequiresNUnitsForMUnitsRequirement(unitType); |
201
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
368 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
|
369 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
|
370 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
|
371 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
|
372 } |
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 [Test()] |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
375 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
|
376 { |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
377 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
|
378 UnitType unitType = new UnitType("testUnit", "Test Unit", race); |
208
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
201
diff
changeset
|
379 UnitRequiresNUnitsForMUnitsRequirement expectedReq = new UnitRequiresNUnitsForMUnitsRequirement(unitType); |
201
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
380 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
|
381 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
|
382 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
|
383 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
|
384 } |
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 [Test()] |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
387 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
|
388 { |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
389 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
|
390 UnitType unitType = new UnitType("testUnit", "Test Unit", race); |
208
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
201
diff
changeset
|
391 UnitRequiresNUnitsForMUnitsRequirement expectedReq = new UnitRequiresNUnitsForMUnitsRequirement(unitType); |
201
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
392 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
|
393 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
|
394 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
|
395 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
|
396 } |
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 [Test()] |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
399 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
|
400 { |
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
401 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
|
402 UnitType unitType = new UnitType("testUnit", "Test Unit", race); |
208
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
201
diff
changeset
|
403 UnitRequiresNUnitsForMUnitsRequirement expectedReq = new UnitRequiresNUnitsForMUnitsRequirement(unitType); |
201
43b571aa4124
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
200
diff
changeset
|
404 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
|
405 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
|
406 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
|
407 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
|
408 } |
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 [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
|
411 [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
|
412 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
|
413 { |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
414 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
|
415 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
|
416 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
|
417 } |
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 [Test()] |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
420 [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
|
421 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
|
422 { |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
423 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
|
424 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
|
425 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
|
426 } |
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 [Test()] |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
429 [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
|
430 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
|
431 { |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
432 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
|
433 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
|
434 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
|
435 } |
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 [Test()] |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
438 [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
|
439 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
|
440 { |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
441 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
|
442 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
|
443 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
|
444 } |
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 [Test()] |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
447 [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
|
448 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
|
449 { |
6a0a0e228e3c
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
194
diff
changeset
|
450 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
|
451 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
|
452 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
|
453 } |
193
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
454 } |
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 |