Mercurial > repos > IBBoard.WarFoundry.API.Tests
annotate API/Factories/Requirement/UnitRequiresNUnitsForMUnitsRequirementFactoryTest.cs @ 193:cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
* Add first unit tests for factory, based on existing factory unit tests
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sat, 03 Dec 2011 16:53:36 +0000 |
parents | |
children | f1f4df654a91 |
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"; |
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; |
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 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
|
23 |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
24 [TestFixtureSetUp()] |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
25 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
|
26 { |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
27 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
|
28 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
|
29 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
|
30 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
|
31 race.AddUnitType(unitType2); |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
32 } |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
33 |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
34 [Test()] |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
35 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
|
36 { |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
37 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
|
38 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
|
39 } |
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 [Test()] |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
42 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
|
43 { |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
44 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
|
45 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
|
46 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
|
47 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
|
48 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
|
49 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
|
50 } |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
51 |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
52 [Test()] |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
53 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
|
54 { |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
55 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
|
56 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
|
57 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
|
58 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
|
59 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
|
60 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
|
61 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
|
62 } |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
63 |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
64 [Test()] |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
65 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
|
66 { |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
67 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
|
68 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
|
69 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
|
70 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
|
71 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
|
72 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
|
73 } |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
74 |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
75 [Test()] |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
76 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
|
77 { |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
78 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
|
79 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
|
80 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
|
81 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
|
82 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
|
83 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
|
84 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
|
85 } |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
86 |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
87 [Test()] |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
88 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
|
89 { |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
90 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
|
91 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
|
92 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
|
93 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
|
94 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
|
95 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
|
96 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
|
97 } |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
98 |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
99 [Test()] |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
100 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
|
101 { |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
102 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
|
103 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
|
104 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
|
105 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
|
106 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
|
107 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
|
108 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
|
109 } |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
110 |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
111 [Test()] |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
112 [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
|
113 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
|
114 { |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
115 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
|
116 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
|
117 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
|
118 } |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
119 |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
120 [Test()] |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
121 [ExpectedException(typeof(InvalidRequirementException), ExpectedMessage="Invalid amount 'a' for unit type 'unit1' 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
|
122 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
|
123 { |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
124 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
|
125 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
|
126 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
|
127 } |
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 } |
cf1c0a91eaa9
Re #350: Add requirement to allow N of unit for specific other units
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
130 |