changeset 221:c40cb2048fc3

Re #394: * Fix UnitRequiresNUnitsForMUnitsRequirementTests unit test so it actually does test the other value * Add tests to "requires at least N" requirement and factory to test alternatives (Rollcall's "-1,X|Y" notation)
author IBBoard <dev@ibboard.co.uk>
date Sat, 24 Mar 2012 20:34:42 +0000
parents 0fa634c6391b
children 12ac487af0ba
files API/Factories/Requirement/UnitRequiresAtLeastNUnitsRequirementFactoryTest.cs API/Objects/Requirement/UnitRequiresAtLeastNUnitsRequirementTest.cs API/Objects/Requirement/UnitRequiresNUnitsForMUnitsRequirementTests.cs
diffstat 3 files changed, 285 insertions(+), 4 deletions(-) [+]
line diff
     1.1 --- a/API/Factories/Requirement/UnitRequiresAtLeastNUnitsRequirementFactoryTest.cs	Sat Mar 24 19:32:47 2012 +0000
     1.2 +++ b/API/Factories/Requirement/UnitRequiresAtLeastNUnitsRequirementFactoryTest.cs	Sat Mar 24 20:34:42 2012 +0000
     1.3 @@ -17,8 +17,10 @@
     1.4  		private static Race race;
     1.5  		private static string typeID1 = "unit1";
     1.6  		private static string typeID2 = "unit2";
     1.7 +		private static string typeID3 = "unit3";
     1.8  		private static UnitType unitType1;
     1.9  		private static UnitType unitType2;
    1.10 +		private static UnitType unitType3;
    1.11  		private static MockRaceFactory raceFactory = new MockRaceFactory();
    1.12  
    1.13  		[TestFixtureSetUp()]
    1.14 @@ -29,6 +31,8 @@
    1.15  			race.AddUnitType(unitType1);
    1.16  			unitType2 = new UnitType(typeID2, "Unit 2", race);
    1.17  			race.AddUnitType(unitType2);
    1.18 +			unitType3 = new UnitType(typeID3, "Unit 3", race);
    1.19 +			race.AddUnitType(unitType3);
    1.20  		}
    1.21  
    1.22  		[Test()]
    1.23 @@ -118,12 +122,181 @@
    1.24  		}
    1.25  
    1.26  		[Test()]
    1.27 -		[ExpectedException(typeof(InvalidRequirementException), ExpectedMessage="Invalid amount 'a' for unit type 'unit1' for 'Requires at least N units' requirement")]
    1.28 +		[ExpectedException(typeof(InvalidRequirementException), ExpectedMessage="Invalid amount 'a' for unit types 'unit1' for 'Requires at least N units' requirement")]
    1.29  		public void TestExceptionsForInvalidNumber()
    1.30  		{
    1.31  			UnitRequiresAtLeastNUnitsRequirementFactory factory = new UnitRequiresAtLeastNUnitsRequirementFactory();
    1.32  			UnitType unitType = new UnitType("testUnit", "Test Unit", race);
    1.33 -			factory.CreateRequirement(unitType, typeID1+":a", raceFactory);
    1.34 +			factory.CreateRequirement(unitType, typeID1 + ":a", raceFactory);
    1.35 +		}
    1.36 +
    1.37 +		[Test()]
    1.38 +		public void TestCreatesCorrectTripleAdditiveRequirement()
    1.39 +		{
    1.40 +			UnitRequiresAtLeastNUnitsRequirementFactory factory = new UnitRequiresAtLeastNUnitsRequirementFactory();
    1.41 +			UnitType unitType = new UnitType("testUnit", "Test Unit", race);
    1.42 +			UnitRequiresAtLeastNUnitsRequirement expectedReq = new UnitRequiresAtLeastNUnitsRequirement(unitType);
    1.43 +			expectedReq.AddUnitTypeRequirement(unitType1, unitType2, unitType3);
    1.44 +			IRequirement req = factory.CreateRequirement(unitType, typeID1 + ";" + typeID2 + ";" + typeID3, raceFactory);
    1.45 +			Assert.That(req, Is.EqualTo(expectedReq));
    1.46 +		}
    1.47 +
    1.48 +		[Test()]
    1.49 +		public void TestCreatesCorrectAdditiveRequirementForTwoIDs()
    1.50 +		{
    1.51 +			UnitRequiresAtLeastNUnitsRequirementFactory factory = new UnitRequiresAtLeastNUnitsRequirementFactory();
    1.52 +			UnitType unitType = new UnitType("testUnit", "Test Unit", race);
    1.53 +			UnitRequiresAtLeastNUnitsRequirement expectedReq = new UnitRequiresAtLeastNUnitsRequirement(unitType);
    1.54 +			expectedReq.AddUnitTypeRequirement(unitType1, unitType2);
    1.55 +			expectedReq.AddUnitTypeRequirement(unitType2);
    1.56 +			IRequirement req = factory.CreateRequirement(unitType, typeID1 + ";" + typeID2 + "|" + typeID2, raceFactory);
    1.57 +			Assert.That(req, Is.EqualTo(expectedReq));
    1.58 +		}
    1.59 +
    1.60 +		[Test()]
    1.61 +		public void TestCreatesCorrectAdditiveRequirementWithNumber()
    1.62 +		{
    1.63 +			UnitRequiresAtLeastNUnitsRequirementFactory factory = new UnitRequiresAtLeastNUnitsRequirementFactory();
    1.64 +			UnitType unitType = new UnitType("testUnit", "Test Unit", race);
    1.65 +			UnitRequiresAtLeastNUnitsRequirement expectedReq = new UnitRequiresAtLeastNUnitsRequirement(unitType);
    1.66 +			expectedReq.AddUnitTypeRequirement(2, unitType1, unitType2);
    1.67 +			IRequirement req = factory.CreateRequirement(unitType, typeID1 + ";" + typeID2 + ":2", raceFactory);
    1.68 +			Assert.That(req, Is.EqualTo(expectedReq));
    1.69 +		}
    1.70 +
    1.71 +		[Test()]
    1.72 +		public void TestCreatesCorrectAdditiveRequirementForTwoIDsWithTwoNumbers()
    1.73 +		{
    1.74 +			UnitRequiresAtLeastNUnitsRequirementFactory factory = new UnitRequiresAtLeastNUnitsRequirementFactory();
    1.75 +			UnitType unitType = new UnitType("testUnit", "Test Unit", race);
    1.76 +			UnitRequiresAtLeastNUnitsRequirement expectedReq = new UnitRequiresAtLeastNUnitsRequirement(unitType);
    1.77 +			expectedReq.AddUnitTypeRequirement(2, unitType1, unitType2);
    1.78 +			expectedReq.AddUnitTypeRequirement(3, unitType2, unitType1);
    1.79 +			IRequirement req = factory.CreateRequirement(unitType, typeID1 + ";" + typeID2 + ":2|" + typeID2 + ";" + typeID1 + ":3", raceFactory);
    1.80 +			Assert.That(req, Is.EqualTo(expectedReq));
    1.81 +		}
    1.82 +
    1.83 +		[Test()]
    1.84 +		public void TestCreatesCorrectAdditiveRequirementForTwoIDsWithOneNumber()
    1.85 +		{
    1.86 +			UnitRequiresAtLeastNUnitsRequirementFactory factory = new UnitRequiresAtLeastNUnitsRequirementFactory();
    1.87 +			UnitType unitType = new UnitType("testUnit", "Test Unit", race);
    1.88 +			UnitRequiresAtLeastNUnitsRequirement expectedReq = new UnitRequiresAtLeastNUnitsRequirement(unitType);
    1.89 +			expectedReq.AddUnitTypeRequirement(2, unitType1, unitType2);
    1.90 +			expectedReq.AddUnitTypeRequirement(unitType2, unitType1);
    1.91 +			IRequirement req = factory.CreateRequirement(unitType, typeID1 + ";" + typeID2 + ":2|" + typeID2 + ";" + typeID1, raceFactory);
    1.92 +			Assert.That(req, Is.EqualTo(expectedReq));
    1.93 +		}
    1.94 +
    1.95 +		[Test()]
    1.96 +		public void TestCreatesCorrectAdditiveRequirementForTwoIDsWithOtherNumber()
    1.97 +		{
    1.98 +			UnitRequiresAtLeastNUnitsRequirementFactory factory = new UnitRequiresAtLeastNUnitsRequirementFactory();
    1.99 +			UnitType unitType = new UnitType("testUnit", "Test Unit", race);
   1.100 +			UnitRequiresAtLeastNUnitsRequirement expectedReq = new UnitRequiresAtLeastNUnitsRequirement(unitType);
   1.101 +			expectedReq.AddUnitTypeRequirement(unitType1, unitType2);
   1.102 +			expectedReq.AddUnitTypeRequirement(3, unitType2, unitType1);
   1.103 +			IRequirement req = factory.CreateRequirement(unitType, typeID1 + ";" + typeID2 + "|" + typeID2 + ";" + typeID1 + ":3", raceFactory);
   1.104 +			Assert.That(req, Is.EqualTo(expectedReq));
   1.105 +		}
   1.106 +
   1.107 +		[Test()]
   1.108 +		public void TestCreatesCorrectRequirementForOneIDAndOneAdditive()
   1.109 +		{
   1.110 +			UnitRequiresAtLeastNUnitsRequirementFactory factory = new UnitRequiresAtLeastNUnitsRequirementFactory();
   1.111 +			UnitType unitType = new UnitType("testUnit", "Test Unit", race);
   1.112 +			UnitRequiresAtLeastNUnitsRequirement expectedReq = new UnitRequiresAtLeastNUnitsRequirement(unitType);
   1.113 +			expectedReq.AddUnitTypeRequirement(unitType1, unitType2);
   1.114 +			expectedReq.AddUnitTypeRequirement(unitType2);
   1.115 +			IRequirement req = factory.CreateRequirement(unitType, typeID1 + ";" + typeID2 + "|" + typeID2, raceFactory);
   1.116 +			Assert.That(req, Is.EqualTo(expectedReq));
   1.117 +		}
   1.118 +
   1.119 +		[Test()]
   1.120 +		public void TestCreatesCorrectRequirementForOneIDAndOneAdditiveInOtherOrder()
   1.121 +		{
   1.122 +			UnitRequiresAtLeastNUnitsRequirementFactory factory = new UnitRequiresAtLeastNUnitsRequirementFactory();
   1.123 +			UnitType unitType = new UnitType("testUnit", "Test Unit", race);
   1.124 +			UnitRequiresAtLeastNUnitsRequirement expectedReq = new UnitRequiresAtLeastNUnitsRequirement(unitType);
   1.125 +			expectedReq.AddUnitTypeRequirement(unitType2);
   1.126 +			expectedReq.AddUnitTypeRequirement(unitType1, unitType2);
   1.127 +			IRequirement req = factory.CreateRequirement(unitType, typeID2 + "|" + typeID1 + ";" + typeID2, raceFactory);
   1.128 +			Assert.That(req, Is.EqualTo(expectedReq));
   1.129 +		}
   1.130 +
   1.131 +		[Test()]
   1.132 +		public void TestCreatesCorrectRequirementForOneIDWithNumberAndOneAdditive()
   1.133 +		{
   1.134 +			UnitRequiresAtLeastNUnitsRequirementFactory factory = new UnitRequiresAtLeastNUnitsRequirementFactory();
   1.135 +			UnitType unitType = new UnitType("testUnit", "Test Unit", race);
   1.136 +			UnitRequiresAtLeastNUnitsRequirement expectedReq = new UnitRequiresAtLeastNUnitsRequirement(unitType);
   1.137 +			expectedReq.AddUnitTypeRequirement(unitType1, unitType2);
   1.138 +			expectedReq.AddUnitTypeRequirement(unitType2, 3);
   1.139 +			IRequirement req = factory.CreateRequirement(unitType, typeID1 + ";" + typeID2 + "|" + typeID2 + ":3", raceFactory);
   1.140 +			Assert.That(req, Is.EqualTo(expectedReq));
   1.141 +		}
   1.142 +
   1.143 +		[Test()]
   1.144 +		public void TestCreatesCorrectRequirementForOneIDWithNumberAndOneAdditiveInOtherOrder()
   1.145 +		{
   1.146 +			UnitRequiresAtLeastNUnitsRequirementFactory factory = new UnitRequiresAtLeastNUnitsRequirementFactory();
   1.147 +			UnitType unitType = new UnitType("testUnit", "Test Unit", race);
   1.148 +			UnitRequiresAtLeastNUnitsRequirement expectedReq = new UnitRequiresAtLeastNUnitsRequirement(unitType);
   1.149 +			expectedReq.AddUnitTypeRequirement(unitType2, 3);
   1.150 +			expectedReq.AddUnitTypeRequirement(unitType1, unitType2);
   1.151 +			IRequirement req = factory.CreateRequirement(unitType, typeID2 + ":3|" + typeID1 + ";" + typeID2, raceFactory);
   1.152 +			Assert.That(req, Is.EqualTo(expectedReq));
   1.153 +		}
   1.154 +
   1.155 +		[Test()]
   1.156 +		public void TestCreatesCorrectRequirementForOneIDAndOneAdditiveWithNumber()
   1.157 +		{
   1.158 +			UnitRequiresAtLeastNUnitsRequirementFactory factory = new UnitRequiresAtLeastNUnitsRequirementFactory();
   1.159 +			UnitType unitType = new UnitType("testUnit", "Test Unit", race);
   1.160 +			UnitRequiresAtLeastNUnitsRequirement expectedReq = new UnitRequiresAtLeastNUnitsRequirement(unitType);
   1.161 +			expectedReq.AddUnitTypeRequirement(3, unitType1, unitType2);
   1.162 +			expectedReq.AddUnitTypeRequirement(unitType2);
   1.163 +			IRequirement req = factory.CreateRequirement(unitType, typeID1 + ";" + typeID2 + ":3|" + typeID2, raceFactory);
   1.164 +			Assert.That(req, Is.EqualTo(expectedReq));
   1.165 +		}
   1.166 +
   1.167 +		[Test()]
   1.168 +		public void TestCreatesCorrectRequirementForOneIDAndOneAdditiveWithNumberInOtherOrder()
   1.169 +		{
   1.170 +			UnitRequiresAtLeastNUnitsRequirementFactory factory = new UnitRequiresAtLeastNUnitsRequirementFactory();
   1.171 +			UnitType unitType = new UnitType("testUnit", "Test Unit", race);
   1.172 +			UnitRequiresAtLeastNUnitsRequirement expectedReq = new UnitRequiresAtLeastNUnitsRequirement(unitType);
   1.173 +			expectedReq.AddUnitTypeRequirement(unitType2);
   1.174 +			expectedReq.AddUnitTypeRequirement(3, unitType1, unitType2);
   1.175 +			IRequirement req = factory.CreateRequirement(unitType, typeID2 + "|" + typeID1 + ";" + typeID2 + ":3", raceFactory);
   1.176 +			Assert.That(req, Is.EqualTo(expectedReq));
   1.177 +		}
   1.178 +
   1.179 +		[Test()]
   1.180 +		[ExpectedException(typeof(InvalidRequirementException), ExpectedMessage="Invalid unit type 'fibble' for 'Requires at least N units' requirement")]
   1.181 +		public void TestExceptionsForAdditiveRequirementWithInvalidID()
   1.182 +		{
   1.183 +			UnitRequiresAtLeastNUnitsRequirementFactory factory = new UnitRequiresAtLeastNUnitsRequirementFactory();
   1.184 +			UnitType unitType = new UnitType("testUnit", "Test Unit", race);
   1.185 +			factory.CreateRequirement(unitType, "fibble;" + typeID1, raceFactory);
   1.186 +		}
   1.187 +
   1.188 +		[Test()]
   1.189 +		[ExpectedException(typeof(InvalidRequirementException), ExpectedMessage="Invalid unit type 'fibble' for 'Requires at least N units' requirement")]
   1.190 +		public void TestExceptionsForAdditiveRequirementWithOtherInvalidID()
   1.191 +		{
   1.192 +			UnitRequiresAtLeastNUnitsRequirementFactory factory = new UnitRequiresAtLeastNUnitsRequirementFactory();
   1.193 +			UnitType unitType = new UnitType("testUnit", "Test Unit", race);
   1.194 +			factory.CreateRequirement(unitType, typeID1 + ";fibble", raceFactory);
   1.195 +		}
   1.196 +
   1.197 +		[Test()]
   1.198 +		[ExpectedException(typeof(InvalidRequirementException), ExpectedMessage="Invalid amount 'a' for unit types 'unit1;unit2' for 'Requires at least N units' requirement")]
   1.199 +		public void TestExceptionsForAdditiveRequirementWithInvalidNumber()
   1.200 +		{
   1.201 +			UnitRequiresAtLeastNUnitsRequirementFactory factory = new UnitRequiresAtLeastNUnitsRequirementFactory();
   1.202 +			UnitType unitType = new UnitType("testUnit", "Test Unit", race);
   1.203 +			factory.CreateRequirement(unitType, typeID1 + ";" + typeID2 + ":a", raceFactory);
   1.204  		}
   1.205  	}
   1.206  }
     2.1 --- a/API/Objects/Requirement/UnitRequiresAtLeastNUnitsRequirementTest.cs	Sat Mar 24 19:32:47 2012 +0000
     2.2 +++ b/API/Objects/Requirement/UnitRequiresAtLeastNUnitsRequirementTest.cs	Sat Mar 24 20:34:42 2012 +0000
     2.3 @@ -33,6 +33,7 @@
     2.4  		[Test()]
     2.5  		public void TestAddingUnitTypeWithNoUnitsAndTwoUnitTypesRequired()
     2.6  		{
     2.7 +			//Rollcall's "-1,X,-1,Y" requirement - unlimited once you have one of both
     2.8  			Army army = new Army(mockRace, "Test", 1000);
     2.9  			UnitRequiresAtLeastNUnitsRequirement req = new UnitRequiresAtLeastNUnitsRequirement(unitType1);
    2.10  			req.AddUnitTypeRequirement(unitType2);
    2.11 @@ -43,6 +44,7 @@
    2.12  		[Test()]
    2.13  		public void TestAddingUnitTypeWithOneUnitAndTwoUnitTypesRequired()
    2.14  		{
    2.15 +			//Rollcall's "-1,X,-1,Y" requirement - unlimited once you have one of both
    2.16  			Army army = new Army(mockRace, "Test", 1000);
    2.17  			AddUnitOfTypeToArmy(unitType2, army);
    2.18  			UnitRequiresAtLeastNUnitsRequirement req = new UnitRequiresAtLeastNUnitsRequirement(unitType1);
    2.19 @@ -54,6 +56,7 @@
    2.20  		[Test()]
    2.21  		public void TestAddingUnitTypeWithOtherOneUnitAndTwoUnitTypesRequired()
    2.22  		{
    2.23 +			//Rollcall's "-1,X,-1,Y" requirement - unlimited once you have one of both
    2.24  			Army army = new Army(mockRace, "Test", 1000);
    2.25  			AddUnitOfTypeToArmy(unitType3, army);
    2.26  			UnitRequiresAtLeastNUnitsRequirement req = new UnitRequiresAtLeastNUnitsRequirement(unitType1);
    2.27 @@ -65,6 +68,7 @@
    2.28  		[Test()]
    2.29  		public void TestAddingUnitTypeWithBothUnitsAndTwoUnitTypesRequired()
    2.30  		{
    2.31 +			//Rollcall's "-1,X,-1,Y" requirement - unlimited once you have one of both
    2.32  			Army army = new Army(mockRace, "Test", 1000);
    2.33  			AddUnitOfTypeToArmy(unitType2, army);
    2.34  			AddUnitOfTypeToArmy(unitType3, army);
    2.35 @@ -136,6 +140,56 @@
    2.36  			Assert_That__PassesAdding(req, unitType1, army);
    2.37  		}
    2.38  
    2.39 +		[Test]
    2.40 +		public void TestAddingRequirementWithOR()
    2.41 +		{
    2.42 +			//Rollcall's "-1,X|Y" requirement - unlimited for one of either
    2.43 +			Army army = new Army(mockRace, "Test", 1000);
    2.44 +			UnitRequiresAtLeastNUnitsRequirement req = new UnitRequiresAtLeastNUnitsRequirement(unitType1);
    2.45 +			req.AddUnitTypeRequirement(unitType2, unitType3);
    2.46 +			Assert_That__FailsAdding(req, unitType1, army, "Army must contain: 1 × " + unitType2.Name + " or " + unitType3.Name + " (would have 0).");
    2.47 +			AddUnitOfTypeToArmy(unitType2, army);
    2.48 +			Assert_That__PassesAdding(req, unitType1, army);
    2.49 +		}
    2.50 +
    2.51 +		[Test]
    2.52 +		public void TestAddingRequirementWithORWithOtherUnit()
    2.53 +		{
    2.54 +			//Rollcall's "-1,X|Y" requirement - unlimited for one of either
    2.55 +			Army army = new Army(mockRace, "Test", 1000);
    2.56 +			UnitRequiresAtLeastNUnitsRequirement req = new UnitRequiresAtLeastNUnitsRequirement(unitType1);
    2.57 +			req.AddUnitTypeRequirement(unitType2, unitType3);
    2.58 +			Assert_That__FailsAdding(req, unitType1, army, "Army must contain: 1 × " + unitType2.Name + " or " + unitType3.Name + " (would have 0).");
    2.59 +			AddUnitOfTypeToArmy(unitType3, army);
    2.60 +			Assert_That__PassesAdding(req, unitType1, army);
    2.61 +		}
    2.62 +
    2.63 +		[Test]
    2.64 +		public void TestAddingRequirementWithORWithLimit()
    2.65 +		{
    2.66 +			Army army = new Army(mockRace, "Test", 1000);
    2.67 +			UnitRequiresAtLeastNUnitsRequirement req = new UnitRequiresAtLeastNUnitsRequirement(unitType1);
    2.68 +			req.AddUnitTypeRequirement(2, unitType2, unitType3);
    2.69 +			Assert_That__FailsAdding(req, unitType1, army, "Army must contain: 2 × " + unitType2.Name + " or " + unitType3.Name + " (would have 0).");
    2.70 +			AddUnitOfTypeToArmy(unitType2, army);
    2.71 +			Assert_That__FailsAdding(req, unitType1, army, "Army must contain: 2 × " + unitType2.Name + " or " + unitType3.Name + " (would have 1).");
    2.72 +			AddUnitOfTypeToArmy(unitType2, army);
    2.73 +			Assert_That__PassesAdding(req, unitType1, army);
    2.74 +		}
    2.75 +
    2.76 +		[Test]
    2.77 +		public void TestAddingRequirementWithORWithLimitWithOtherUnit()
    2.78 +		{
    2.79 +			Army army = new Army(mockRace, "Test", 1000);
    2.80 +			UnitRequiresAtLeastNUnitsRequirement req = new UnitRequiresAtLeastNUnitsRequirement(unitType1);
    2.81 +			req.AddUnitTypeRequirement(2, unitType2, unitType3);
    2.82 +			Assert_That__FailsAdding(req, unitType1, army, "Army must contain: 2 × " + unitType2.Name + " or " + unitType3.Name + " (would have 0).");
    2.83 +			AddUnitOfTypeToArmy(unitType3, army);
    2.84 +			Assert_That__FailsAdding(req, unitType1, army, "Army must contain: 2 × " + unitType2.Name + " or " + unitType3.Name + " (would have 1).");
    2.85 +			AddUnitOfTypeToArmy(unitType3, army);
    2.86 +			Assert_That__PassesAdding(req, unitType1, army);
    2.87 +		}
    2.88 +
    2.89  		[Test()]
    2.90  		public void TestValidatingWithNoUnitsAndOneUnitTypeRequired()
    2.91  		{
    2.92 @@ -264,6 +318,60 @@
    2.93  			Assert_That__ValidationPasses(req, army);
    2.94  		}
    2.95  
    2.96 +		[Test]
    2.97 +		public void TestRequirementWithOR()
    2.98 +		{
    2.99 +			//Rollcall's "-1,X|Y" requirement - unlimited for one of either
   2.100 +			Army army = new Army(mockRace, "Test", 1000);
   2.101 +			UnitRequiresAtLeastNUnitsRequirement req = new UnitRequiresAtLeastNUnitsRequirement(unitType1);
   2.102 +			req.AddUnitTypeRequirement(unitType2, unitType3);
   2.103 +			AddUnitOfTypeToArmy(unitType1, army);
   2.104 +			Assert_That__ValidationFails(req, army, "Army must contain: 1 × " + unitType2.Name + " or " + unitType3.Name + " (have 0).");
   2.105 +			AddUnitOfTypeToArmy(unitType2, army);
   2.106 +			Assert_That__ValidationPasses(req, army);
   2.107 +		}
   2.108 +
   2.109 +		[Test]
   2.110 +		public void TestRequirementWithORWithOtherUnit()
   2.111 +		{
   2.112 +			//Rollcall's "-1,X|Y" requirement - unlimited for one of either
   2.113 +			Army army = new Army(mockRace, "Test", 1000);
   2.114 +			UnitRequiresAtLeastNUnitsRequirement req = new UnitRequiresAtLeastNUnitsRequirement(unitType1);
   2.115 +			req.AddUnitTypeRequirement(unitType2, unitType3);
   2.116 +			AddUnitOfTypeToArmy(unitType1, army);
   2.117 +			Assert_That__ValidationFails(req, army, "Army must contain: 1 × " + unitType2.Name + " or " + unitType3.Name + " (have 0).");
   2.118 +			AddUnitOfTypeToArmy(unitType3, army);
   2.119 +			Assert_That__ValidationPasses(req, army);
   2.120 +		}
   2.121 +
   2.122 +		[Test]
   2.123 +		public void TestRequirementWithORWithLimit()
   2.124 +		{
   2.125 +			Army army = new Army(mockRace, "Test", 1000);
   2.126 +			UnitRequiresAtLeastNUnitsRequirement req = new UnitRequiresAtLeastNUnitsRequirement(unitType1);
   2.127 +			req.AddUnitTypeRequirement(2, unitType2, unitType3);
   2.128 +			AddUnitOfTypeToArmy(unitType1, army);
   2.129 +			Assert_That__ValidationFails(req, army, "Army must contain: 2 × " + unitType2.Name + " or " + unitType3.Name + " (have 0).");
   2.130 +			AddUnitOfTypeToArmy(unitType2, army);
   2.131 +			Assert_That__ValidationFails(req, army, "Army must contain: 2 × " + unitType2.Name + " or " + unitType3.Name + " (have 1).");
   2.132 +			AddUnitOfTypeToArmy(unitType2, army);
   2.133 +			Assert_That__ValidationPasses(req, army);
   2.134 +		}
   2.135 +
   2.136 +		[Test]
   2.137 +		public void TestRequirementWithORWithLimitWithOtherUnit()
   2.138 +		{
   2.139 +			Army army = new Army(mockRace, "Test", 1000);
   2.140 +			UnitRequiresAtLeastNUnitsRequirement req = new UnitRequiresAtLeastNUnitsRequirement(unitType1);
   2.141 +			req.AddUnitTypeRequirement(2, unitType2, unitType3);
   2.142 +			AddUnitOfTypeToArmy(unitType1, army);
   2.143 +			Assert_That__ValidationFails(req, army, "Army must contain: 2 × " + unitType2.Name + " or " + unitType3.Name + " (have 0).");
   2.144 +			AddUnitOfTypeToArmy(unitType3, army);
   2.145 +			Assert_That__ValidationFails(req, army, "Army must contain: 2 × " + unitType2.Name + " or " + unitType3.Name + " (have 1).");
   2.146 +			AddUnitOfTypeToArmy(unitType3, army);
   2.147 +			Assert_That__ValidationPasses(req, army);
   2.148 +		}
   2.149 +
   2.150  		protected override UnitRequiresAtLeastNUnitsRequirement CreateRequirement(UnitType requirementOn)
   2.151  		{
   2.152  			return new UnitRequiresAtLeastNUnitsRequirement(requirementOn);
     3.1 --- a/API/Objects/Requirement/UnitRequiresNUnitsForMUnitsRequirementTests.cs	Sat Mar 24 19:32:47 2012 +0000
     3.2 +++ b/API/Objects/Requirement/UnitRequiresNUnitsForMUnitsRequirementTests.cs	Sat Mar 24 20:34:42 2012 +0000
     3.3 @@ -168,7 +168,7 @@
     3.4  			UnitRequiresNUnitsForMUnitsRequirement req = new UnitRequiresNUnitsForMUnitsRequirement(unitType1);
     3.5  			req.AddUnitTypeRequirement(unitType2, unitType3);
     3.6  			Assert_That__FailsAdding(req, unitType1, army, "Army must contain: 1 × " + unitType2.Name + " or " + unitType3.Name + " for every 1 × " + unitType1.Name + " (would have 0 for 1).");
     3.7 -			AddUnitOfTypeToArmy(unitType2, army);
     3.8 +			AddUnitOfTypeToArmy(unitType3, army);
     3.9  			Assert_That__PassesAdding(req, unitType1, army);
    3.10  		}
    3.11  
    3.12 @@ -403,7 +403,7 @@
    3.13  			req.AddUnitTypeRequirement(unitType2, unitType3);
    3.14  			AddUnitOfTypeToArmy(unitType1, army);
    3.15  			Assert_That__ValidationFails(req, army, "Army must contain: 1 × " + unitType2.Name + " or " + unitType3.Name + " for every 1 × " + unitType1.Name + " (have 0 for 1).");
    3.16 -			AddUnitOfTypeToArmy(unitType2, army);
    3.17 +			AddUnitOfTypeToArmy(unitType3, army);
    3.18  			Assert_That__ValidationPasses(req, army);
    3.19  		}
    3.20