changeset 208:c323770e61c2

Re #379: Fix validation of requirements to check for unit * Rename classes in tests to match API changes * Alter tests to match new API (all classes require at least one UnitType that they're relevant to now)
author IBBoard <dev@ibboard.co.uk>
date Wed, 22 Feb 2012 20:48:40 +0000
parents 27f163bf884a
children fc9a90d29ae0
files API/Factories/Requirement/Mock/MockRequirement.cs API/Factories/Requirement/UnitRequiresNUnitsForMUnitsRequirementFactoryTest.cs API/Objects/Requirement/Mock/AbstractFixedRequirement.cs API/Objects/Requirement/Mock/MockRequiresNUnitsForMObjectsRequirement.cs API/Objects/Requirement/RequiresAtLeastNUnitsRequirementTest.cs API/Objects/Requirement/RequiresNUnitsForMObjectsRequirementTest.cs API/Objects/Requirement/RequiresNUnitsForMUnitsRequirementTest.cs API/Objects/Requirement/RequiresNoMoreThanNOfUnitTypeRequirementTest.cs API/Objects/Requirement/UnitRequiresAtLeastNUnitsRequirementTest.cs API/Objects/Requirement/UnitRequiresNUnitsForMUnitsRequirementTests.cs API/Objects/Requirement/UnitRequiresNoMoreThanNOfUnitTypeRequirementTest.cs API/Objects/UnitTypeTest.cs IBBoard.WarFoundry.API.Tests.csproj
diffstat 13 files changed, 1238 insertions(+), 897 deletions(-) [+]
line diff
     1.1 --- a/API/Factories/Requirement/Mock/MockRequirement.cs	Tue Jan 31 20:59:15 2012 +0000
     1.2 +++ b/API/Factories/Requirement/Mock/MockRequirement.cs	Wed Feb 22 20:48:40 2012 +0000
     1.3 @@ -21,7 +21,7 @@
     1.4  			}
     1.5  		}
     1.6  
     1.7 -		public Validation AllowsAdding(WarFoundryObject wfObject, Army toArmy)
     1.8 +		public Validation AllowsAdding(IWarFoundryObject wfObject, Army toArmy)
     1.9  		{
    1.10  			throw new NotImplementedException();
    1.11  		}
    1.12 @@ -36,7 +36,7 @@
    1.13  			throw new NotImplementedException();
    1.14  		}
    1.15  
    1.16 -		public string GetAllowsAddingMessage(UnitType toAdd, Army toArmy)
    1.17 +		public string GetAllowsAddingMessage(IWarFoundryObject toAdd, Army toArmy)
    1.18  		{
    1.19  			throw new NotImplementedException();
    1.20  		}
     2.1 --- a/API/Factories/Requirement/UnitRequiresNUnitsForMUnitsRequirementFactoryTest.cs	Tue Jan 31 20:59:15 2012 +0000
     2.2 +++ b/API/Factories/Requirement/UnitRequiresNUnitsForMUnitsRequirementFactoryTest.cs	Wed Feb 22 20:48:40 2012 +0000
     2.3 @@ -12,7 +12,7 @@
     2.4  namespace IBBoard.WarFoundry.API.Factories.Requirement
     2.5  {
     2.6  	[TestFixture()]
     2.7 -	public class UnitUnitRequiresNUnitsForMUnitsRequirementFactoryTest
     2.8 +	public class UnitRequiresNUnitsForMUnitsRequirementFactoryTest
     2.9  	{
    2.10  		private static Race race;
    2.11  		private static string typeID1 = "unit1";
    2.12 @@ -47,7 +47,7 @@
    2.13  		{
    2.14  			UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory();
    2.15  			UnitType unitType = new UnitType("testUnit", "Test Unit", race);
    2.16 -			RequiresNUnitsForMUnitsRequirement expectedReq = new RequiresNUnitsForMUnitsRequirement(unitType);
    2.17 +			UnitRequiresNUnitsForMUnitsRequirement expectedReq = new UnitRequiresNUnitsForMUnitsRequirement(unitType);
    2.18  			expectedReq.AddUnitTypeRequirement(unitType1);
    2.19  			IRequirement req = factory.CreateRequirement(unitType, typeID1, raceFactory);
    2.20  			Assert.That(req, Is.EqualTo(expectedReq));
    2.21 @@ -58,7 +58,7 @@
    2.22  		{
    2.23  			UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory();
    2.24  			UnitType unitType = new UnitType("testUnit", "Test Unit", race);
    2.25 -			RequiresNUnitsForMUnitsRequirement expectedReq = new RequiresNUnitsForMUnitsRequirement(unitType);
    2.26 +			UnitRequiresNUnitsForMUnitsRequirement expectedReq = new UnitRequiresNUnitsForMUnitsRequirement(unitType);
    2.27  			expectedReq.AddUnitTypeRequirement(unitType1);
    2.28  			expectedReq.AddUnitTypeRequirement(unitType2);
    2.29  			IRequirement req = factory.CreateRequirement(unitType, typeID1 + "|" + typeID2, raceFactory);
    2.30 @@ -70,7 +70,7 @@
    2.31  		{
    2.32  			UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory();
    2.33  			UnitType unitType = new UnitType("testUnit", "Test Unit", race);
    2.34 -			RequiresNUnitsForMUnitsRequirement expectedReq = new RequiresNUnitsForMUnitsRequirement(unitType);
    2.35 +			UnitRequiresNUnitsForMUnitsRequirement expectedReq = new UnitRequiresNUnitsForMUnitsRequirement(unitType);
    2.36  			expectedReq.AddUnitTypeRequirement(unitType1);
    2.37  			expectedReq.AddUnitTypeRequirement(unitType2);
    2.38  			expectedReq.AddUnitTypeRequirement(unitType3);
    2.39 @@ -83,7 +83,7 @@
    2.40  		{
    2.41  			UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory();
    2.42  			UnitType unitType = new UnitType("testUnit", "Test Unit", race);
    2.43 -			RequiresNUnitsForMUnitsRequirement expectedReq = new RequiresNUnitsForMUnitsRequirement(unitType);
    2.44 +			UnitRequiresNUnitsForMUnitsRequirement expectedReq = new UnitRequiresNUnitsForMUnitsRequirement(unitType);
    2.45  			expectedReq.AddUnitTypeRequirement(unitType1, 2);
    2.46  			IRequirement req = factory.CreateRequirement(unitType, typeID1 + ":2", raceFactory);
    2.47  			Assert.That(req, Is.EqualTo(expectedReq));
    2.48 @@ -94,7 +94,7 @@
    2.49  		{
    2.50  			UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory();
    2.51  			UnitType unitType = new UnitType("testUnit", "Test Unit", race);
    2.52 -			RequiresNUnitsForMUnitsRequirement expectedReq = new RequiresNUnitsForMUnitsRequirement(unitType);
    2.53 +			UnitRequiresNUnitsForMUnitsRequirement expectedReq = new UnitRequiresNUnitsForMUnitsRequirement(unitType);
    2.54  			expectedReq.AddUnitTypeRequirement(unitType1, 2, 3);
    2.55  			IRequirement req = factory.CreateRequirement(unitType, typeID1 + ":2;3", raceFactory);
    2.56  			Assert.That(req, Is.EqualTo(expectedReq));
    2.57 @@ -105,7 +105,7 @@
    2.58  		{
    2.59  			UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory();
    2.60  			UnitType unitType = new UnitType("testUnit", "Test Unit", race);
    2.61 -			RequiresNUnitsForMUnitsRequirement expectedReq = new RequiresNUnitsForMUnitsRequirement(unitType);
    2.62 +			UnitRequiresNUnitsForMUnitsRequirement expectedReq = new UnitRequiresNUnitsForMUnitsRequirement(unitType);
    2.63  			expectedReq.AddUnitTypeRequirement(unitType1, 2);
    2.64  			expectedReq.AddUnitTypeRequirement(unitType2, 3);
    2.65  			IRequirement req = factory.CreateRequirement(unitType, typeID1 + ":2|" + typeID2 + ":3", raceFactory);
    2.66 @@ -117,7 +117,7 @@
    2.67  		{
    2.68  			UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory();
    2.69  			UnitType unitType = new UnitType("testUnit", "Test Unit", race);
    2.70 -			RequiresNUnitsForMUnitsRequirement expectedReq = new RequiresNUnitsForMUnitsRequirement(unitType);
    2.71 +			UnitRequiresNUnitsForMUnitsRequirement expectedReq = new UnitRequiresNUnitsForMUnitsRequirement(unitType);
    2.72  			expectedReq.AddUnitTypeRequirement(unitType1, 2);
    2.73  			expectedReq.AddUnitTypeRequirement(unitType2);
    2.74  			IRequirement req = factory.CreateRequirement(unitType, typeID1 + ":2|" + typeID2, raceFactory);
    2.75 @@ -129,7 +129,7 @@
    2.76  		{
    2.77  			UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory();
    2.78  			UnitType unitType = new UnitType("testUnit", "Test Unit", race);
    2.79 -			RequiresNUnitsForMUnitsRequirement expectedReq = new RequiresNUnitsForMUnitsRequirement(unitType);
    2.80 +			UnitRequiresNUnitsForMUnitsRequirement expectedReq = new UnitRequiresNUnitsForMUnitsRequirement(unitType);
    2.81  			expectedReq.AddUnitTypeRequirement(unitType1);
    2.82  			expectedReq.AddUnitTypeRequirement(unitType2, 3);
    2.83  			IRequirement req = factory.CreateRequirement(unitType, typeID1 + "|" + typeID2 + ":3", raceFactory);
    2.84 @@ -151,7 +151,7 @@
    2.85  		{
    2.86  			UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory();
    2.87  			UnitType unitType = new UnitType("testUnit", "Test Unit", race);
    2.88 -			factory.CreateRequirement(unitType, typeID1+":a", raceFactory);
    2.89 +			factory.CreateRequirement(unitType, typeID1 + ":a", raceFactory);
    2.90  		}
    2.91  
    2.92  		[Test()]
    2.93 @@ -177,7 +177,7 @@
    2.94  		{
    2.95  			UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory();
    2.96  			UnitType unitType = new UnitType("testUnit", "Test Unit", race);
    2.97 -			RequiresNUnitsForMUnitsRequirement expectedReq = new RequiresNUnitsForMUnitsRequirement(unitType);
    2.98 +			UnitRequiresNUnitsForMUnitsRequirement expectedReq = new UnitRequiresNUnitsForMUnitsRequirement(unitType);
    2.99  			expectedReq.AddUnitTypeRequirement(unitType1, unitType2);
   2.100  			IRequirement req = factory.CreateRequirement(unitType, typeID1 + ";" + typeID2, raceFactory);
   2.101  			Assert.That(req, Is.EqualTo(expectedReq));
   2.102 @@ -188,7 +188,7 @@
   2.103  		{
   2.104  			UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory();
   2.105  			UnitType unitType = new UnitType("testUnit", "Test Unit", race);
   2.106 -			RequiresNUnitsForMUnitsRequirement expectedReq = new RequiresNUnitsForMUnitsRequirement(unitType);
   2.107 +			UnitRequiresNUnitsForMUnitsRequirement expectedReq = new UnitRequiresNUnitsForMUnitsRequirement(unitType);
   2.108  			expectedReq.AddUnitTypeRequirement(unitType1, unitType2, unitType3);
   2.109  			IRequirement req = factory.CreateRequirement(unitType, typeID1 + ";" + typeID2 + ";" + typeID3, raceFactory);
   2.110  			Assert.That(req, Is.EqualTo(expectedReq));
   2.111 @@ -199,7 +199,7 @@
   2.112  		{
   2.113  			UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory();
   2.114  			UnitType unitType = new UnitType("testUnit", "Test Unit", race);
   2.115 -			RequiresNUnitsForMUnitsRequirement expectedReq = new RequiresNUnitsForMUnitsRequirement(unitType);
   2.116 +			UnitRequiresNUnitsForMUnitsRequirement expectedReq = new UnitRequiresNUnitsForMUnitsRequirement(unitType);
   2.117  			expectedReq.AddUnitTypeRequirement(unitType1, unitType2);
   2.118  			expectedReq.AddUnitTypeRequirement(unitType2);
   2.119  			IRequirement req = factory.CreateRequirement(unitType, typeID1 + ";" + typeID2 + "|" + typeID2, raceFactory);
   2.120 @@ -211,7 +211,7 @@
   2.121  		{
   2.122  			UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory();
   2.123  			UnitType unitType = new UnitType("testUnit", "Test Unit", race);
   2.124 -			RequiresNUnitsForMUnitsRequirement expectedReq = new RequiresNUnitsForMUnitsRequirement(unitType);
   2.125 +			UnitRequiresNUnitsForMUnitsRequirement expectedReq = new UnitRequiresNUnitsForMUnitsRequirement(unitType);
   2.126  			expectedReq.AddUnitTypeRequirement(2, unitType1, unitType2);
   2.127  			IRequirement req = factory.CreateRequirement(unitType, typeID1 + ";" + typeID2 + ":2", raceFactory);
   2.128  			Assert.That(req, Is.EqualTo(expectedReq));
   2.129 @@ -222,7 +222,7 @@
   2.130  		{
   2.131  			UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory();
   2.132  			UnitType unitType = new UnitType("testUnit", "Test Unit", race);
   2.133 -			RequiresNUnitsForMUnitsRequirement expectedReq = new RequiresNUnitsForMUnitsRequirement(unitType);
   2.134 +			UnitRequiresNUnitsForMUnitsRequirement expectedReq = new UnitRequiresNUnitsForMUnitsRequirement(unitType);
   2.135  			expectedReq.AddUnitTypeRequirement(2, 3, unitType1, unitType2);
   2.136  			IRequirement req = factory.CreateRequirement(unitType, typeID1 + ";" + typeID2 + ":2;3", raceFactory);
   2.137  			Assert.That(req, Is.EqualTo(expectedReq));
   2.138 @@ -233,7 +233,7 @@
   2.139  		{
   2.140  			UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory();
   2.141  			UnitType unitType = new UnitType("testUnit", "Test Unit", race);
   2.142 -			RequiresNUnitsForMUnitsRequirement expectedReq = new RequiresNUnitsForMUnitsRequirement(unitType);
   2.143 +			UnitRequiresNUnitsForMUnitsRequirement expectedReq = new UnitRequiresNUnitsForMUnitsRequirement(unitType);
   2.144  			expectedReq.AddUnitTypeRequirement(2, unitType1, unitType2);
   2.145  			expectedReq.AddUnitTypeRequirement(3, unitType2, unitType1);
   2.146  			IRequirement req = factory.CreateRequirement(unitType, typeID1 + ";" + typeID2 + ":2|" + typeID2 + ";" + typeID1 + ":3", raceFactory);
   2.147 @@ -245,7 +245,7 @@
   2.148  		{
   2.149  			UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory();
   2.150  			UnitType unitType = new UnitType("testUnit", "Test Unit", race);
   2.151 -			RequiresNUnitsForMUnitsRequirement expectedReq = new RequiresNUnitsForMUnitsRequirement(unitType);
   2.152 +			UnitRequiresNUnitsForMUnitsRequirement expectedReq = new UnitRequiresNUnitsForMUnitsRequirement(unitType);
   2.153  			expectedReq.AddUnitTypeRequirement(2, unitType1, unitType2);
   2.154  			expectedReq.AddUnitTypeRequirement(unitType2, unitType1);
   2.155  			IRequirement req = factory.CreateRequirement(unitType, typeID1 + ";" + typeID2 + ":2|" + typeID2 + ";" + typeID1, raceFactory);
   2.156 @@ -257,7 +257,7 @@
   2.157  		{
   2.158  			UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory();
   2.159  			UnitType unitType = new UnitType("testUnit", "Test Unit", race);
   2.160 -			RequiresNUnitsForMUnitsRequirement expectedReq = new RequiresNUnitsForMUnitsRequirement(unitType);
   2.161 +			UnitRequiresNUnitsForMUnitsRequirement expectedReq = new UnitRequiresNUnitsForMUnitsRequirement(unitType);
   2.162  			expectedReq.AddUnitTypeRequirement(unitType1, unitType2);
   2.163  			expectedReq.AddUnitTypeRequirement(3, unitType2, unitType1);
   2.164  			IRequirement req = factory.CreateRequirement(unitType, typeID1 + ";" + typeID2 + "|" + typeID2 + ";" + typeID1 + ":3", raceFactory);
   2.165 @@ -269,7 +269,7 @@
   2.166  		{
   2.167  			UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory();
   2.168  			UnitType unitType = new UnitType("testUnit", "Test Unit", race);
   2.169 -			RequiresNUnitsForMUnitsRequirement expectedReq = new RequiresNUnitsForMUnitsRequirement(unitType);
   2.170 +			UnitRequiresNUnitsForMUnitsRequirement expectedReq = new UnitRequiresNUnitsForMUnitsRequirement(unitType);
   2.171  			expectedReq.AddUnitTypeRequirement(unitType1, unitType2);
   2.172  			expectedReq.AddUnitTypeRequirement(unitType2);
   2.173  			IRequirement req = factory.CreateRequirement(unitType, typeID1 + ";" + typeID2 + "|" + typeID2, raceFactory);
   2.174 @@ -281,7 +281,7 @@
   2.175  		{
   2.176  			UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory();
   2.177  			UnitType unitType = new UnitType("testUnit", "Test Unit", race);
   2.178 -			RequiresNUnitsForMUnitsRequirement expectedReq = new RequiresNUnitsForMUnitsRequirement(unitType);
   2.179 +			UnitRequiresNUnitsForMUnitsRequirement expectedReq = new UnitRequiresNUnitsForMUnitsRequirement(unitType);
   2.180  			expectedReq.AddUnitTypeRequirement(unitType2);
   2.181  			expectedReq.AddUnitTypeRequirement(unitType1, unitType2);
   2.182  			IRequirement req = factory.CreateRequirement(unitType, typeID2 + "|" + typeID1 + ";" + typeID2, raceFactory);
   2.183 @@ -293,7 +293,7 @@
   2.184  		{
   2.185  			UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory();
   2.186  			UnitType unitType = new UnitType("testUnit", "Test Unit", race);
   2.187 -			RequiresNUnitsForMUnitsRequirement expectedReq = new RequiresNUnitsForMUnitsRequirement(unitType);
   2.188 +			UnitRequiresNUnitsForMUnitsRequirement expectedReq = new UnitRequiresNUnitsForMUnitsRequirement(unitType);
   2.189  			expectedReq.AddUnitTypeRequirement(unitType1, unitType2);
   2.190  			expectedReq.AddUnitTypeRequirement(unitType2, 3);
   2.191  			IRequirement req = factory.CreateRequirement(unitType, typeID1 + ";" + typeID2 + "|" + typeID2 + ":3", raceFactory);
   2.192 @@ -305,7 +305,7 @@
   2.193  		{
   2.194  			UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory();
   2.195  			UnitType unitType = new UnitType("testUnit", "Test Unit", race);
   2.196 -			RequiresNUnitsForMUnitsRequirement expectedReq = new RequiresNUnitsForMUnitsRequirement(unitType);
   2.197 +			UnitRequiresNUnitsForMUnitsRequirement expectedReq = new UnitRequiresNUnitsForMUnitsRequirement(unitType);
   2.198  			expectedReq.AddUnitTypeRequirement(unitType2, 3);
   2.199  			expectedReq.AddUnitTypeRequirement(unitType1, unitType2);
   2.200  			IRequirement req = factory.CreateRequirement(unitType, typeID2 + ":3|" + typeID1 + ";" + typeID2, raceFactory);
   2.201 @@ -317,7 +317,7 @@
   2.202  		{
   2.203  			UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory();
   2.204  			UnitType unitType = new UnitType("testUnit", "Test Unit", race);
   2.205 -			RequiresNUnitsForMUnitsRequirement expectedReq = new RequiresNUnitsForMUnitsRequirement(unitType);
   2.206 +			UnitRequiresNUnitsForMUnitsRequirement expectedReq = new UnitRequiresNUnitsForMUnitsRequirement(unitType);
   2.207  			expectedReq.AddUnitTypeRequirement(3, unitType1, unitType2);
   2.208  			expectedReq.AddUnitTypeRequirement(unitType2);
   2.209  			IRequirement req = factory.CreateRequirement(unitType, typeID1 + ";" + typeID2 + ":3|" + typeID2, raceFactory);
   2.210 @@ -329,7 +329,7 @@
   2.211  		{
   2.212  			UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory();
   2.213  			UnitType unitType = new UnitType("testUnit", "Test Unit", race);
   2.214 -			RequiresNUnitsForMUnitsRequirement expectedReq = new RequiresNUnitsForMUnitsRequirement(unitType);
   2.215 +			UnitRequiresNUnitsForMUnitsRequirement expectedReq = new UnitRequiresNUnitsForMUnitsRequirement(unitType);
   2.216  			expectedReq.AddUnitTypeRequirement(unitType2);
   2.217  			expectedReq.AddUnitTypeRequirement(3, unitType1, unitType2);
   2.218  			IRequirement req = factory.CreateRequirement(unitType, typeID2 + "|" + typeID1 + ";" + typeID2 + ":3", raceFactory);
   2.219 @@ -341,7 +341,7 @@
   2.220  		{
   2.221  			UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory();
   2.222  			UnitType unitType = new UnitType("testUnit", "Test Unit", race);
   2.223 -			RequiresNUnitsForMUnitsRequirement expectedReq = new RequiresNUnitsForMUnitsRequirement(unitType);
   2.224 +			UnitRequiresNUnitsForMUnitsRequirement expectedReq = new UnitRequiresNUnitsForMUnitsRequirement(unitType);
   2.225  			expectedReq.AddUnitTypeRequirement(unitType1, unitType2);
   2.226  			expectedReq.AddUnitTypeRequirement(3, 2, unitType2);
   2.227  			IRequirement req = factory.CreateRequirement(unitType, typeID1 + ";" + typeID2 + "|" + typeID2 + ":3;2", raceFactory);
   2.228 @@ -353,10 +353,10 @@
   2.229  		{
   2.230  			UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory();
   2.231  			UnitType unitType = new UnitType("testUnit", "Test Unit", race);
   2.232 -			RequiresNUnitsForMUnitsRequirement expectedReq = new RequiresNUnitsForMUnitsRequirement(unitType);
   2.233 +			UnitRequiresNUnitsForMUnitsRequirement expectedReq = new UnitRequiresNUnitsForMUnitsRequirement(unitType);
   2.234  			expectedReq.AddUnitTypeRequirement(3, 2, unitType2);
   2.235  			expectedReq.AddUnitTypeRequirement(unitType1, unitType2);
   2.236 -			IRequirement req = factory.CreateRequirement(unitType, typeID2  + ":3;2|" + typeID1 + ";" + typeID2, raceFactory);
   2.237 +			IRequirement req = factory.CreateRequirement(unitType, typeID2 + ":3;2|" + typeID1 + ";" + typeID2, raceFactory);
   2.238  			Assert.That(req, Is.EqualTo(expectedReq));
   2.239  		}
   2.240  
   2.241 @@ -365,7 +365,7 @@
   2.242  		{
   2.243  			UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory();
   2.244  			UnitType unitType = new UnitType("testUnit", "Test Unit", race);
   2.245 -			RequiresNUnitsForMUnitsRequirement expectedReq = new RequiresNUnitsForMUnitsRequirement(unitType);
   2.246 +			UnitRequiresNUnitsForMUnitsRequirement expectedReq = new UnitRequiresNUnitsForMUnitsRequirement(unitType);
   2.247  			expectedReq.AddUnitTypeRequirement(3, 2, unitType1, unitType2);
   2.248  			expectedReq.AddUnitTypeRequirement(unitType2, 3);
   2.249  			IRequirement req = factory.CreateRequirement(unitType, typeID1 + ";" + typeID2 + ":3;2|" + typeID2 + ":3", raceFactory);
   2.250 @@ -377,7 +377,7 @@
   2.251  		{
   2.252  			UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory();
   2.253  			UnitType unitType = new UnitType("testUnit", "Test Unit", race);
   2.254 -			RequiresNUnitsForMUnitsRequirement expectedReq = new RequiresNUnitsForMUnitsRequirement(unitType);
   2.255 +			UnitRequiresNUnitsForMUnitsRequirement expectedReq = new UnitRequiresNUnitsForMUnitsRequirement(unitType);
   2.256  			expectedReq.AddUnitTypeRequirement(unitType2, 3);
   2.257  			expectedReq.AddUnitTypeRequirement(3, 2, unitType1, unitType2);
   2.258  			IRequirement req = factory.CreateRequirement(unitType, typeID2 + ":3|" + typeID1 + ";" + typeID2 + ":3;2", raceFactory);
   2.259 @@ -389,7 +389,7 @@
   2.260  		{
   2.261  			UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory();
   2.262  			UnitType unitType = new UnitType("testUnit", "Test Unit", race);
   2.263 -			RequiresNUnitsForMUnitsRequirement expectedReq = new RequiresNUnitsForMUnitsRequirement(unitType);
   2.264 +			UnitRequiresNUnitsForMUnitsRequirement expectedReq = new UnitRequiresNUnitsForMUnitsRequirement(unitType);
   2.265  			expectedReq.AddUnitTypeRequirement(3, unitType1, unitType2);
   2.266  			expectedReq.AddUnitTypeRequirement(unitType2, 3, 2);
   2.267  			IRequirement req = factory.CreateRequirement(unitType, typeID1 + ";" + typeID2 + ":3|" + typeID2 + ":3;2", raceFactory);
   2.268 @@ -401,7 +401,7 @@
   2.269  		{
   2.270  			UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory();
   2.271  			UnitType unitType = new UnitType("testUnit", "Test Unit", race);
   2.272 -			RequiresNUnitsForMUnitsRequirement expectedReq = new RequiresNUnitsForMUnitsRequirement(unitType);
   2.273 +			UnitRequiresNUnitsForMUnitsRequirement expectedReq = new UnitRequiresNUnitsForMUnitsRequirement(unitType);
   2.274  			expectedReq.AddUnitTypeRequirement(unitType2, 3, 2);
   2.275  			expectedReq.AddUnitTypeRequirement(3, unitType1, unitType2);
   2.276  			IRequirement req = factory.CreateRequirement(unitType, typeID2 + ":3;2|" + typeID1 + ";" + typeID2 + ":3", raceFactory);
     3.1 --- a/API/Objects/Requirement/Mock/AbstractFixedRequirement.cs	Tue Jan 31 20:59:15 2012 +0000
     3.2 +++ b/API/Objects/Requirement/Mock/AbstractFixedRequirement.cs	Wed Feb 22 20:48:40 2012 +0000
     3.3 @@ -19,22 +19,22 @@
     3.4  			result = fixedResult;
     3.5  		}
     3.6  
     3.7 -		public Validation AllowsAdding (WarFoundryObject wfObject, Army toArmy)
     3.8 +		public Validation AllowsAdding(IWarFoundryObject wfObject, Army toArmy)
     3.9  		{
    3.10  			return result;
    3.11  		}
    3.12  
    3.13 -		public Validation ValidatesArmy (Army army)
    3.14 +		public Validation ValidatesArmy(Army army)
    3.15  		{
    3.16  			return result;
    3.17  		}
    3.18  
    3.19 -		public string GetValidationMessage (Army army)
    3.20 +		public string GetValidationMessage(Army army)
    3.21  		{
    3.22  			return (result.Equals(Validation.Failed)) ? "Validation failed" : "";
    3.23  		}
    3.24  
    3.25 -		public string GetAllowsAddingMessage (UnitType toAdd, Army toArmy)
    3.26 +		public string GetAllowsAddingMessage(IWarFoundryObject toAdd, Army toArmy)
    3.27  		{
    3.28  			return (result.Equals(Validation.Failed)) ? "Validation failed" : "";
    3.29  		}
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/API/Objects/Requirement/Mock/MockRequiresNUnitsForMObjectsRequirement.cs	Wed Feb 22 20:48:40 2012 +0000
     4.3 @@ -0,0 +1,38 @@
     4.4 +// This file (MockRequiresNUnitsForMObjectsRequirement.cs) is a part of the IBBoard.WarFoundry.API.Tests project and is copyright 2012 IBBoard
     4.5 +// 
     4.6 +// 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.
     4.7 +using System;
     4.8 +
     4.9 +namespace IBBoard.WarFoundry.API.Objects.Requirement.Mock
    4.10 +{
    4.11 +	public class MockRequiresNUnitsForMObjectsRequirement : RequiresNUnitsForMObjectsRequirement<IWarFoundryObject>
    4.12 +	{
    4.13 +		public MockRequiresNUnitsForMObjectsRequirement(IWarFoundryObject allowedObject) : base(allowedObject)
    4.14 +		{
    4.15 +		}
    4.16 +
    4.17 +		protected override int GetObjectCountFromArmy(Army toArmy, IWarFoundryObject obj)
    4.18 +		{
    4.19 +			throw new NotImplementedException();
    4.20 +		}
    4.21 +
    4.22 +		protected override int GetObjectCountFromArmy(Army toArmy)
    4.23 +		{
    4.24 +			throw new NotImplementedException();
    4.25 +		}
    4.26 +
    4.27 +		protected override int GetAllowedObjectCount(Army army)
    4.28 +		{
    4.29 +			throw new NotImplementedException();
    4.30 +		}
    4.31 +
    4.32 +		public override string RequirementID
    4.33 +		{
    4.34 +			get
    4.35 +			{
    4.36 +				return GetType().FullName;
    4.37 +			}
    4.38 +		}
    4.39 +	}
    4.40 +}
    4.41 +
     5.1 --- a/API/Objects/Requirement/RequiresAtLeastNUnitsRequirementTest.cs	Tue Jan 31 20:59:15 2012 +0000
     5.2 +++ b/API/Objects/Requirement/RequiresAtLeastNUnitsRequirementTest.cs	Wed Feb 22 20:48:40 2012 +0000
     5.3 @@ -12,9 +12,10 @@
     5.4  namespace IBBoard.WarFoundry.API.Objects.Requirement
     5.5  {
     5.6  	[TestFixture()]
     5.7 -	public class RequiresAtLeastNUnitsRequirementTest : AbstractEqualityTest<RequiresAtLeastNUnitsRequirement>
     5.8 +	public class RequiresAtLeastNUnitsRequirementTest : AbstractEqualityTest<RequiresAtLeastNUnitsRequirement<UnitType>>
     5.9  	{
    5.10  		private MockRace mockRace;
    5.11 +		private UnitType allowedUnitType;
    5.12  		private UnitType unitType1;
    5.13  		private UnitType unitType2;
    5.14  		private UnitType unitType3;
    5.15 @@ -23,6 +24,8 @@
    5.16  		public void SetupRace()
    5.17  		{
    5.18  			mockRace = new MockRace();
    5.19 +			allowedUnitType = new MockUnitType("allowed", "Allowed Type");
    5.20 +			mockRace.AddUnitType(allowedUnitType);
    5.21  			unitType1 = new MockUnitType("type1", "Unit Type 1");
    5.22  			mockRace.AddUnitType(unitType1);
    5.23  			unitType2 = new MockUnitType("type2", "Unit Type 2");
    5.24 @@ -36,7 +39,7 @@
    5.25  		{
    5.26  			Army army = new Army(mockRace, "Test", 1000);
    5.27  			Unit unit = CreateUnitOfType(unitType1, army);
    5.28 -			RequiresAtLeastNUnitsRequirement req = new RequiresAtLeastNUnitsRequirement(unitType2);
    5.29 +			RequiresAtLeastNUnitsRequirement<UnitType> req = new RequiresAtLeastNUnitsRequirement<UnitType>(allowedUnitType, unitType2);
    5.30  			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.NotApplicable));
    5.31  		}
    5.32  
    5.33 @@ -45,7 +48,7 @@
    5.34  		{
    5.35  			Army army = new Army(mockRace, "Test", 1000);
    5.36  			Unit unit = CreateUnitOfType(unitType1, army);
    5.37 -			RequiresAtLeastNUnitsRequirement req = new RequiresAtLeastNUnitsRequirement(unitType1);
    5.38 +			RequiresAtLeastNUnitsRequirement<UnitType> req = new RequiresAtLeastNUnitsRequirement<UnitType>(allowedUnitType, unitType1);
    5.39  			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Passed));
    5.40  		}
    5.41  
    5.42 @@ -53,7 +56,7 @@
    5.43  		public void TestAddingUnitWithOneUnitAndTwoOfUnitTypeRequired()
    5.44  		{
    5.45  			Army army = new Army(mockRace, "Test", 1000);
    5.46 -			RequiresAtLeastNUnitsRequirement req = new RequiresAtLeastNUnitsRequirement();
    5.47 +			RequiresAtLeastNUnitsRequirement<UnitType> req = new RequiresAtLeastNUnitsRequirement<UnitType>(allowedUnitType);
    5.48  			req.AddUnitTypeRequirement(unitType1, 2);
    5.49  			AddUnitOfTypeToArmy(unitType1, army);
    5.50  			Unit unit = CreateUnitOfType(unitType1, army);
    5.51 @@ -64,7 +67,7 @@
    5.52  		public void TestAddingUnrelatedUnitTypeWithNoUnitsAndOneUnitTypeRequired()
    5.53  		{
    5.54  			Army army = new Army(mockRace, "Test", 1000);
    5.55 -			RequiresAtLeastNUnitsRequirement req = new RequiresAtLeastNUnitsRequirement(unitType2);
    5.56 +			RequiresAtLeastNUnitsRequirement<UnitType> req = new RequiresAtLeastNUnitsRequirement<UnitType>(allowedUnitType, unitType2);
    5.57  			Assert.That(req.AllowsAdding(unitType1, army), Is.EqualTo(Validation.NotApplicable));
    5.58  		}
    5.59  
    5.60 @@ -72,7 +75,7 @@
    5.61  		public void TestAddingUnitTypeWithNoUnitsAndOneUnitTypeRequired()
    5.62  		{
    5.63  			Army army = new Army(mockRace, "Test", 1000);
    5.64 -			RequiresAtLeastNUnitsRequirement req = new RequiresAtLeastNUnitsRequirement(unitType1);
    5.65 +			RequiresAtLeastNUnitsRequirement<UnitType> req = new RequiresAtLeastNUnitsRequirement<UnitType>(allowedUnitType, unitType1);
    5.66  			Assert.That(req.AllowsAdding(unitType1, army), Is.EqualTo(Validation.Passed));
    5.67  		}
    5.68  
    5.69 @@ -81,7 +84,7 @@
    5.70  		{
    5.71  			Army army = new Army(mockRace, "Test", 1000);
    5.72  			AddUnitOfTypeToArmy(unitType1, army);
    5.73 -			RequiresAtLeastNUnitsRequirement req = new RequiresAtLeastNUnitsRequirement(unitType1);
    5.74 +			RequiresAtLeastNUnitsRequirement<UnitType> req = new RequiresAtLeastNUnitsRequirement<UnitType>(allowedUnitType, unitType1);
    5.75  			Assert.That(req.AllowsAdding(unitType1, army), Is.EqualTo(Validation.Passed));
    5.76  		}
    5.77  
    5.78 @@ -89,7 +92,7 @@
    5.79  		public void TestAddingUnitTypeWithNoUnitsAndTwoUnitTypesRequired()
    5.80  		{
    5.81  			Army army = new Army(mockRace, "Test", 1000);
    5.82 -			RequiresAtLeastNUnitsRequirement req = new RequiresAtLeastNUnitsRequirement(unitType2, unitType3);
    5.83 +			RequiresAtLeastNUnitsRequirement<UnitType> req = new RequiresAtLeastNUnitsRequirement<UnitType>(allowedUnitType, unitType2, unitType3);
    5.84  			Assert.That(req.AllowsAdding(unitType2, army), Is.EqualTo(Validation.Failed));
    5.85  		}
    5.86  
    5.87 @@ -98,7 +101,7 @@
    5.88  		{
    5.89  			Army army = new Army(mockRace, "Test", 1000);
    5.90  			AddUnitOfTypeToArmy(unitType3, army);
    5.91 -			RequiresAtLeastNUnitsRequirement req = new RequiresAtLeastNUnitsRequirement(unitType2, unitType3);
    5.92 +			RequiresAtLeastNUnitsRequirement<UnitType> req = new RequiresAtLeastNUnitsRequirement<UnitType>(allowedUnitType, unitType2, unitType3);
    5.93  			Assert.That(req.AllowsAdding(unitType2, army), Is.EqualTo(Validation.Passed));
    5.94  		}
    5.95  
    5.96 @@ -108,7 +111,7 @@
    5.97  			Army army = new Army(mockRace, "Test", 1000);
    5.98  			AddUnitOfTypeToArmy(unitType2, army);
    5.99  			AddUnitOfTypeToArmy(unitType3, army);
   5.100 -			RequiresAtLeastNUnitsRequirement req = new RequiresAtLeastNUnitsRequirement(unitType2, unitType3);
   5.101 +			RequiresAtLeastNUnitsRequirement<UnitType> req = new RequiresAtLeastNUnitsRequirement<UnitType>(allowedUnitType, unitType2, unitType3);
   5.102  			Assert.That(req.AllowsAdding(unitType2, army), Is.EqualTo(Validation.Passed));
   5.103  		}
   5.104  
   5.105 @@ -116,7 +119,7 @@
   5.106  		public void TestAddingOneOfUnitTypeWithTwoOfOneUnitTypeRequired()
   5.107  		{
   5.108  			Army army = new Army(mockRace, "Test", 1000);
   5.109 -			RequiresAtLeastNUnitsRequirement req = new RequiresAtLeastNUnitsRequirement();
   5.110 +			RequiresAtLeastNUnitsRequirement<UnitType> req = new RequiresAtLeastNUnitsRequirement<UnitType>(allowedUnitType);
   5.111  			req.AddUnitTypeRequirement(unitType1, 2);
   5.112  			Assert.That(req.AllowsAdding(unitType1, army), Is.EqualTo(Validation.Failed));
   5.113  		}
   5.114 @@ -126,7 +129,7 @@
   5.115  		{
   5.116  			Army army = new Army(mockRace, "Test", 1000);
   5.117  			AddUnitOfTypeToArmy(unitType1, army);
   5.118 -			RequiresAtLeastNUnitsRequirement req = new RequiresAtLeastNUnitsRequirement();
   5.119 +			RequiresAtLeastNUnitsRequirement<UnitType> req = new RequiresAtLeastNUnitsRequirement<UnitType>(allowedUnitType);
   5.120  			req.AddUnitTypeRequirement(unitType1, 2);
   5.121  			Assert.That(req.AllowsAdding(unitType1, army), Is.EqualTo(Validation.Passed));
   5.122  		}
   5.123 @@ -135,7 +138,7 @@
   5.124  		public void TestAddingUnitTypeRequirementWithNoNumberDefaultsToHavingOne()
   5.125  		{
   5.126  			Army army = new Army(mockRace, "Test", 1000);
   5.127 -			RequiresAtLeastNUnitsRequirement req = new RequiresAtLeastNUnitsRequirement();
   5.128 +			RequiresAtLeastNUnitsRequirement<UnitType> req = new RequiresAtLeastNUnitsRequirement<UnitType>(allowedUnitType);
   5.129  			req.AddUnitTypeRequirement(unitType1);
   5.130  			Assert.That(req.AllowsAdding(unitType1, army), Is.EqualTo(Validation.Passed));
   5.131  		}
   5.132 @@ -144,7 +147,7 @@
   5.133  		public void TestValidityOfArmyWithNoUnitsAndOneUnitTypeRequired()
   5.134  		{
   5.135  			Army army = new Army(mockRace, "Test", 1000);
   5.136 -			RequiresAtLeastNUnitsRequirement req = new RequiresAtLeastNUnitsRequirement(unitType1);
   5.137 +			RequiresAtLeastNUnitsRequirement<UnitType> req = new RequiresAtLeastNUnitsRequirement<UnitType>(allowedUnitType, unitType1);
   5.138  			Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Failed));
   5.139  		}
   5.140  
   5.141 @@ -153,7 +156,7 @@
   5.142  		{
   5.143  			Army army = new Army(mockRace, "Test", 1000);
   5.144  			AddUnitOfTypeToArmy(unitType1, army);
   5.145 -			RequiresAtLeastNUnitsRequirement req = new RequiresAtLeastNUnitsRequirement(unitType1);
   5.146 +			RequiresAtLeastNUnitsRequirement<UnitType> req = new RequiresAtLeastNUnitsRequirement<UnitType>(allowedUnitType, unitType1);
   5.147  			Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Passed));
   5.148  		}
   5.149  
   5.150 @@ -161,7 +164,7 @@
   5.151  		public void TestAddingMinNumberUnitTypePassesRequirement()
   5.152  		{
   5.153  			Army army = new Army(mockRace, "Test", 1000);
   5.154 -			RequiresAtLeastNUnitsRequirement req = new RequiresAtLeastNUnitsRequirement();
   5.155 +			RequiresAtLeastNUnitsRequirement<UnitType> req = new RequiresAtLeastNUnitsRequirement<UnitType>(allowedUnitType);
   5.156  			req.AddUnitTypeRequirement(unitType1, 2);
   5.157  			Assert.That(req.AllowsAdding(unitType1, army), Is.EqualTo(Validation.Failed));
   5.158  			AddUnitOfTypeToArmy(unitType1, army);
   5.159 @@ -173,7 +176,7 @@
   5.160  		{
   5.161  			Army army = new Army(mockRace, "Test", 1000);
   5.162  			AddUnitOfTypeToArmy(unitType1, army);
   5.163 -			RequiresAtLeastNUnitsRequirement req = new RequiresAtLeastNUnitsRequirement(unitType1);
   5.164 +			RequiresAtLeastNUnitsRequirement<UnitType> req = new RequiresAtLeastNUnitsRequirement<UnitType>(allowedUnitType, unitType1);
   5.165  			Assert.That(req.GetValidationMessage(army), Is.Empty);
   5.166  		}
   5.167  
   5.168 @@ -181,7 +184,7 @@
   5.169  		public void TestValidationMessageIsCorrectForFailWithOneUnitRequired()
   5.170  		{
   5.171  			Army army = new Army(mockRace, "Test", 1000);
   5.172 -			RequiresAtLeastNUnitsRequirement req = new RequiresAtLeastNUnitsRequirement(unitType1);
   5.173 +			RequiresAtLeastNUnitsRequirement<UnitType> req = new RequiresAtLeastNUnitsRequirement<UnitType>(allowedUnitType, unitType1);
   5.174  			Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 1 × " + unitType1.Name + " (have 0)."));
   5.175  		}
   5.176  
   5.177 @@ -189,7 +192,7 @@
   5.178  		public void TestValidationMessageIsCorrectForFailWithTwoOfOneUnitRequired()
   5.179  		{
   5.180  			Army army = new Army(mockRace, "Test", 1000);
   5.181 -			RequiresAtLeastNUnitsRequirement req = new RequiresAtLeastNUnitsRequirement();
   5.182 +			RequiresAtLeastNUnitsRequirement<UnitType> req = new RequiresAtLeastNUnitsRequirement<UnitType>(allowedUnitType);
   5.183  			req.AddUnitTypeRequirement(unitType1, 2);
   5.184  			Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 2 × " + unitType1.Name + " (have 0)."));
   5.185  		}
   5.186 @@ -198,7 +201,7 @@
   5.187  		public void TestValidationMessageIsCorrectForFailWithTwoUnitsRequired()
   5.188  		{
   5.189  			Army army = new Army(mockRace, "Test", 1000);
   5.190 -			RequiresAtLeastNUnitsRequirement req = new RequiresAtLeastNUnitsRequirement();
   5.191 +			RequiresAtLeastNUnitsRequirement<UnitType> req = new RequiresAtLeastNUnitsRequirement<UnitType>(allowedUnitType);
   5.192  			req.AddUnitTypeRequirement(unitType1);
   5.193  			req.AddUnitTypeRequirement(unitType2);
   5.194  			Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 1 × " + unitType1.Name + " (have 0); 1 × " + unitType2.Name + " (have 0)."));
   5.195 @@ -209,7 +212,7 @@
   5.196  		{
   5.197  			Army army = new Army(mockRace, "Test", 1000);
   5.198  			AddUnitOfTypeToArmy(unitType1, army);
   5.199 -			RequiresAtLeastNUnitsRequirement req = new RequiresAtLeastNUnitsRequirement();
   5.200 +			RequiresAtLeastNUnitsRequirement<UnitType> req = new RequiresAtLeastNUnitsRequirement<UnitType>(allowedUnitType);
   5.201  			req.AddUnitTypeRequirement(unitType1);
   5.202  			req.AddUnitTypeRequirement(unitType2);
   5.203  			Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " (have 0)."));
   5.204 @@ -220,7 +223,7 @@
   5.205  		{
   5.206  			Army army = new Army(mockRace, "Test", 1000);
   5.207  			AddUnitOfTypeToArmy(unitType2, army);
   5.208 -			RequiresAtLeastNUnitsRequirement req = new RequiresAtLeastNUnitsRequirement();
   5.209 +			RequiresAtLeastNUnitsRequirement<UnitType> req = new RequiresAtLeastNUnitsRequirement<UnitType>(allowedUnitType);
   5.210  			req.AddUnitTypeRequirement(unitType1);
   5.211  			req.AddUnitTypeRequirement(unitType2);
   5.212  			Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 1 × " + unitType1.Name + " (have 0)."));
   5.213 @@ -231,7 +234,7 @@
   5.214  		{
   5.215  			Army army = new Army(mockRace, "Test", 1000);
   5.216  			AddUnitOfTypeToArmy(unitType1, army);
   5.217 -			RequiresAtLeastNUnitsRequirement req = new RequiresAtLeastNUnitsRequirement(unitType1);
   5.218 +			RequiresAtLeastNUnitsRequirement<UnitType> req = new RequiresAtLeastNUnitsRequirement<UnitType>(allowedUnitType, unitType1);
   5.219  			Assert.That(req.GetAllowsAddingMessage(unitType1, army), Is.Empty);
   5.220  		}
   5.221  
   5.222 @@ -239,7 +242,7 @@
   5.223  		public void TestAllowsAddingMessageIsCorrectForFailWithTwoOfOneUnitRequired()
   5.224  		{
   5.225  			Army army = new Army(mockRace, "Test", 1000);
   5.226 -			RequiresAtLeastNUnitsRequirement req = new RequiresAtLeastNUnitsRequirement();
   5.227 +			RequiresAtLeastNUnitsRequirement<UnitType> req = new RequiresAtLeastNUnitsRequirement<UnitType>(allowedUnitType);
   5.228  			req.AddUnitTypeRequirement(unitType1, 2);
   5.229  			Assert.That(req.GetAllowsAddingMessage(unitType1, army), Is.EqualTo("Army must contain: 2 × " + unitType1.Name + " (would have 1)."));
   5.230  		}
   5.231 @@ -248,7 +251,7 @@
   5.232  		public void TestAllowsAddingMessageIsCorrectForFailWithTwoUnitsRequired()
   5.233  		{
   5.234  			Army army = new Army(mockRace, "Test", 1000);
   5.235 -			RequiresAtLeastNUnitsRequirement req = new RequiresAtLeastNUnitsRequirement();
   5.236 +			RequiresAtLeastNUnitsRequirement<UnitType> req = new RequiresAtLeastNUnitsRequirement<UnitType>(allowedUnitType);
   5.237  			req.AddUnitTypeRequirement(unitType1);
   5.238  			req.AddUnitTypeRequirement(unitType2);
   5.239  			Assert.That(req.GetAllowsAddingMessage(unitType1, army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " (would have 0)."));
   5.240 @@ -258,7 +261,7 @@
   5.241  		public void TestAllowsAddingMessageIsCorrectForFailWithTwoUnitsRequiredOtherUnit()
   5.242  		{
   5.243  			Army army = new Army(mockRace, "Test", 1000);
   5.244 -			RequiresAtLeastNUnitsRequirement req = new RequiresAtLeastNUnitsRequirement();
   5.245 +			RequiresAtLeastNUnitsRequirement<UnitType> req = new RequiresAtLeastNUnitsRequirement<UnitType>(allowedUnitType);
   5.246  			req.AddUnitTypeRequirement(unitType1);
   5.247  			req.AddUnitTypeRequirement(unitType2);
   5.248  			Assert.That(req.GetAllowsAddingMessage(unitType2, army), Is.EqualTo("Army must contain: 1 × " + unitType1.Name + " (would have 0)."));
   5.249 @@ -269,7 +272,7 @@
   5.250  		{
   5.251  			Army army = new Army(mockRace, "Test", 1000);
   5.252  			AddUnitOfTypeToArmy(unitType1, army);
   5.253 -			RequiresAtLeastNUnitsRequirement req = new RequiresAtLeastNUnitsRequirement();
   5.254 +			RequiresAtLeastNUnitsRequirement<UnitType> req = new RequiresAtLeastNUnitsRequirement<UnitType>(allowedUnitType);
   5.255  			req.AddUnitTypeRequirement(unitType1);
   5.256  			req.AddUnitTypeRequirement(unitType2);
   5.257  			Assert.That(req.GetAllowsAddingMessage(unitType1, army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " (would have 0)."));
   5.258 @@ -280,7 +283,7 @@
   5.259  		{
   5.260  			Army army = new Army(mockRace, "Test", 1000);
   5.261  			AddUnitOfTypeToArmy(unitType2, army);
   5.262 -			RequiresAtLeastNUnitsRequirement req = new RequiresAtLeastNUnitsRequirement();
   5.263 +			RequiresAtLeastNUnitsRequirement<UnitType> req = new RequiresAtLeastNUnitsRequirement<UnitType>(allowedUnitType);
   5.264  			req.AddUnitTypeRequirement(unitType1);
   5.265  			req.AddUnitTypeRequirement(unitType2);
   5.266  			Assert.That(req.GetAllowsAddingMessage(unitType2, army), Is.EqualTo("Army must contain: 1 × " + unitType1.Name + " (would have 0)."));
   5.267 @@ -296,23 +299,23 @@
   5.268  			return new Unit(unitType, army.GetCategory(unitType.MainCategory));
   5.269  		}
   5.270  
   5.271 -		public override RequiresAtLeastNUnitsRequirement GetObject ()
   5.272 +		public override RequiresAtLeastNUnitsRequirement<UnitType> GetObject()
   5.273  		{
   5.274 -			RequiresAtLeastNUnitsRequirement req = new RequiresAtLeastNUnitsRequirement();
   5.275 +			RequiresAtLeastNUnitsRequirement<UnitType> req = new RequiresAtLeastNUnitsRequirement<UnitType>(allowedUnitType);
   5.276  			req.AddUnitTypeRequirement(unitType1, 2);
   5.277  			return req;
   5.278  		}
   5.279  
   5.280 -		public override RequiresAtLeastNUnitsRequirement GetSameObject ()
   5.281 +		public override RequiresAtLeastNUnitsRequirement<UnitType> GetSameObject()
   5.282  		{
   5.283 -			RequiresAtLeastNUnitsRequirement req = new RequiresAtLeastNUnitsRequirement();
   5.284 +			RequiresAtLeastNUnitsRequirement<UnitType> req = new RequiresAtLeastNUnitsRequirement<UnitType>(allowedUnitType);
   5.285  			req.AddUnitTypeRequirement(unitType1, 2);
   5.286  			return req;
   5.287  		}
   5.288  
   5.289 -		public override RequiresAtLeastNUnitsRequirement GetDifferentObject ()
   5.290 +		public override RequiresAtLeastNUnitsRequirement<UnitType> GetDifferentObject()
   5.291  		{
   5.292 -			RequiresAtLeastNUnitsRequirement req = new RequiresAtLeastNUnitsRequirement();
   5.293 +			RequiresAtLeastNUnitsRequirement<UnitType> req = new RequiresAtLeastNUnitsRequirement<UnitType>(allowedUnitType);
   5.294  			DummyWarFoundryFactory factory = new DummyWarFoundryFactory();
   5.295  			GameSystem gameSystem = new GameSystem("system", "system", factory);
   5.296  			Race race = new Race("race", "race", gameSystem, factory);
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/API/Objects/Requirement/RequiresNUnitsForMObjectsRequirementTest.cs	Wed Feb 22 20:48:40 2012 +0000
     6.3 @@ -0,0 +1,754 @@
     6.4 +// This file (UnitRequiresNUnitsForMObjectsRequirement.cs) is a part of the IBBoard.WarFoundry.API.Tests project and is copyright 2011 IBBoard
     6.5 +// 
     6.6 +// 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.
     6.7 +using System;
     6.8 +using NUnit.Framework;
     6.9 +using IBBoard.WarFoundry.API.Objects.Mock;
    6.10 +using NUnit.Framework.SyntaxHelpers;
    6.11 +using System.Reflection;
    6.12 +using IBBoard.NUnit;
    6.13 +using IBBoard.WarFoundry.API.Factories;
    6.14 +
    6.15 +namespace IBBoard.WarFoundry.API.Objects.Requirement
    6.16 +{
    6.17 +	public abstract class RequiresNUnitsForMObjectsRequirementTest : AbstractEqualityTest<RequiresNUnitsForMObjectsRequirement<UnitType>>
    6.18 +	{
    6.19 +		private MockRace mockRace;
    6.20 +		private UnitType unitType1;
    6.21 +		private UnitType unitType2;
    6.22 +		private UnitType unitType3;
    6.23 +		private UnitType unitType4;
    6.24 +
    6.25 +		[TestFixtureSetUp()]
    6.26 +		public void SetupRace()
    6.27 +		{
    6.28 +			mockRace = MockRace.GetMockRace();
    6.29 +			unitType1 = new MockUnitType("type1", "Unit Type 1");
    6.30 +			mockRace.AddUnitType(unitType1);
    6.31 +			unitType2 = new MockUnitType("type2", "Unit Type 2");
    6.32 +			mockRace.AddUnitType(unitType2);
    6.33 +			unitType3 = new MockUnitType("type3", "Unit Type 3");
    6.34 +			mockRace.AddUnitType(unitType3);
    6.35 +			unitType4 = new MockUnitType("type4", "Unit Type 4");
    6.36 +			mockRace.AddUnitType(unitType4);
    6.37 +		}
    6.38 +
    6.39 +		[Test()]
    6.40 +		public void TestAddingUnrelatedUnitWithNoUnitsAndOneUnitTypeRequiredIsNA()
    6.41 +		{
    6.42 +			Army army = new Army(mockRace, "Test", 1000);
    6.43 +			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1, unitType2);
    6.44 +			Unit unit = CreateUnitOfType(unitType3, army);
    6.45 +			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.NotApplicable));
    6.46 +			Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.Empty);
    6.47 +		}
    6.48 +
    6.49 +		[Test()]
    6.50 +		public void TestAddingOneUnitWithOneUnitTypeRequiredAndOneUnitOfTypePasses()
    6.51 +		{
    6.52 +			Army army = new Army(mockRace, "Test", 1000);
    6.53 +			AddUnitOfTypeToArmy(unitType2, army);
    6.54 +			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1, unitType2);
    6.55 +			Unit unit = CreateUnitOfType(unitType1, army);
    6.56 +			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Passed));
    6.57 +			Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.Empty);
    6.58 +		}
    6.59 +
    6.60 +		[Test()]
    6.61 +		public void TestAddingOneUnitWithOneUnitTypeRequiredAndNoUnitOfTypeFails()
    6.62 +		{
    6.63 +			Army army = new Army(mockRace, "Test", 1000);
    6.64 +			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1, unitType2);
    6.65 +			Unit unit = CreateUnitOfType(unitType1, army);
    6.66 +			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed));
    6.67 +			Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " for every 1 × " + unitType1.Name + " (would have 0 for 1)."));
    6.68 +		}
    6.69 +
    6.70 +		[Test()]
    6.71 +		public void TestAddingOneUnitWithTwoDifferentUnitTypesRequiredAndNoUnitOfOneTypeFails()
    6.72 +		{
    6.73 +			Army army = new Army(mockRace, "Test", 1000);
    6.74 +			AddUnitOfTypeToArmy(unitType2, army);
    6.75 +			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1);
    6.76 +			req.AddUnitTypeRequirement(unitType2);
    6.77 +			req.AddUnitTypeRequirement(unitType3);
    6.78 +			Unit unit = CreateUnitOfType(unitType1, army);
    6.79 +			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed));
    6.80 +			Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 1 × " + unitType3.Name + " for every 1 × " + unitType1.Name + " (would have 0 for 1)."));
    6.81 +		}
    6.82 +
    6.83 +		[Test()]
    6.84 +		public void TestAddingTwoUnitsWithOneUnitTypeRequiredAndOneUnitOfTypeFails()
    6.85 +		{
    6.86 +			Army army = new Army(mockRace, "Test", 1000);
    6.87 +			AddUnitOfTypeToArmy(unitType2, army);
    6.88 +			AddUnitOfTypeToArmy(unitType1, army);
    6.89 +			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1, unitType2);
    6.90 +			Unit unit = CreateUnitOfType(unitType1, army);
    6.91 +			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed));
    6.92 +			Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " for every 1 × " + unitType1.Name + " (would have 1 for 2)."));
    6.93 +		}
    6.94 +
    6.95 +		[Test()]
    6.96 +		public void TestAddingTwoUnitsWithTwoOfUnitTypeAllowedForOneUnitTypeRequiredAndOneUnitOfTypePasses()
    6.97 +		{
    6.98 +			Army army = new Army(mockRace, "Test", 1000);
    6.99 +			AddUnitOfTypeToArmy(unitType2, army);
   6.100 +			AddUnitOfTypeToArmy(unitType1, army);
   6.101 +			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1);
   6.102 +			req.AddUnitTypeRequirement(unitType2, 1, 2);
   6.103 +			Unit unit = CreateUnitOfType(unitType1, army);
   6.104 +			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Passed));
   6.105 +			Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.Empty);
   6.106 +		}
   6.107 +
   6.108 +		[Test()]
   6.109 +		public void TestAddingTwoUnitsWithTwoAllowedAndOneAllowedForDifferentTypesFails()
   6.110 +		{
   6.111 +			Army army = new Army(mockRace, "Test", 1000);
   6.112 +			AddUnitOfTypeToArmy(unitType2, army);
   6.113 +			AddUnitOfTypeToArmy(unitType3, army);
   6.114 +			AddUnitOfTypeToArmy(unitType1, army);
   6.115 +			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1);
   6.116 +			req.AddUnitTypeRequirement(unitType2, 1, 2);
   6.117 +			req.AddUnitTypeRequirement(unitType3, 1, 1);
   6.118 +			Unit unit = CreateUnitOfType(unitType1, army);
   6.119 +			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed));
   6.120 +			Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 1 × " + unitType3.Name + " for every 1 × " + unitType1.Name + " (would have 1 for 2)."));
   6.121 +		}
   6.122 +
   6.123 +		[Test()]
   6.124 +		public void TestAddingSecondUnitsWithOneAllowedForTwoTypesFails()
   6.125 +		{
   6.126 +			Army army = new Army(mockRace, "Test", 1000);
   6.127 +			AddUnitOfTypeToArmy(unitType2, army);
   6.128 +			AddUnitOfTypeToArmy(unitType3, army);
   6.129 +			AddUnitOfTypeToArmy(unitType1, army);
   6.130 +			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1);
   6.131 +			req.AddUnitTypeRequirement(unitType2, 1, 1);
   6.132 +			req.AddUnitTypeRequirement(unitType3, 1, 1);
   6.133 +			Unit unit = CreateUnitOfType(unitType1, army);
   6.134 +			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed));
   6.135 +			Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " for every 1 × " + unitType1.Name + " (would have 1 for 2); 1 × " + unitType3.Name + " for every 1 × " + unitType1.Name + " (would have 1 for 2)."));
   6.136 +		}
   6.137 +
   6.138 +		[Test()]
   6.139 +		public void TestAddingSecondUnitsWithOneAllowedForTwoTypesFails_ShorthandMethod()
   6.140 +		{
   6.141 +			Army army = new Army(mockRace, "Test", 1000);
   6.142 +			AddUnitOfTypeToArmy(unitType2, army);
   6.143 +			AddUnitOfTypeToArmy(unitType3, army);
   6.144 +			AddUnitOfTypeToArmy(unitType1, army);
   6.145 +			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1, unitType2, unitType3);
   6.146 +			Unit unit = CreateUnitOfType(unitType1, army);
   6.147 +			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed));
   6.148 +			Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " for every 1 × " + unitType1.Name + " (would have 1 for 2); 1 × " + unitType3.Name + " for every 1 × " + unitType1.Name + " (would have 1 for 2)."));
   6.149 +		}
   6.150 +
   6.151 +		[Test()]
   6.152 +		public void TestAddingThreeUnitsWithTwoOfUnitTypeAllowedForOneUnitTypeRequiredAndOneUnitOfTypeFails()
   6.153 +		{
   6.154 +			Army army = new Army(mockRace, "Test", 1000);
   6.155 +			AddUnitOfTypeToArmy(unitType2, army);
   6.156 +			AddUnitOfTypeToArmy(unitType1, army);
   6.157 +			AddUnitOfTypeToArmy(unitType1, army);
   6.158 +			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1);
   6.159 +			req.AddUnitTypeRequirement(unitType2, 1, 2);
   6.160 +			Unit unit = CreateUnitOfType(unitType1, army);
   6.161 +			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed));
   6.162 +			Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " for every 2 × " + unitType1.Name + " (would have 1 for 3)."));
   6.163 +		}
   6.164 +
   6.165 +		[Test()]
   6.166 +		public void TestAddingOneUnitWithThreeOfUnitTypeAllowedForTwoOfUnitTypeRequiredAndOneUnitOfTypeFails()
   6.167 +		{
   6.168 +			Army army = new Army(mockRace, "Test", 1000);
   6.169 +			AddUnitOfTypeToArmy(unitType2, army);
   6.170 +			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1);
   6.171 +			req.AddUnitTypeRequirement(unitType2, 2, 3);
   6.172 +			Unit unit = CreateUnitOfType(unitType1, army);
   6.173 +			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed));
   6.174 +			Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 2 × " + unitType2.Name + " for every 3 × " + unitType1.Name + " (would have 1 for 1)."));
   6.175 +		}
   6.176 +
   6.177 +		[Test()]
   6.178 +		public void TestAddingSecondUnitWithThreeOfUnitTypeAllowedForTwoOfUnitTypeRequiredAndOneUnitOfTypeFails()
   6.179 +		{
   6.180 +			Army army = new Army(mockRace, "Test", 1000);
   6.181 +			AddUnitOfTypeToArmy(unitType2, army);
   6.182 +			AddUnitOfTypeToArmy(unitType1, army);
   6.183 +			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1);
   6.184 +			req.AddUnitTypeRequirement(unitType2, 2, 3);
   6.185 +			Unit unit = CreateUnitOfType(unitType1, army);
   6.186 +			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed));
   6.187 +			Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 2 × " + unitType2.Name + " for every 3 × " + unitType1.Name + " (would have 1 for 2)."));
   6.188 +		}
   6.189 +
   6.190 +		[Test()]
   6.191 +		public void TestAddingFourthUnitWithThreeOfUnitTypeAllowedForTwoOfUnitTypeRequiredAndThreeUnitsOfTypeFails()
   6.192 +		{
   6.193 +			Army army = new Army(mockRace, "Test", 1000);
   6.194 +			AddUnitsOfTypeToArmy(3, unitType2, army);
   6.195 +			AddUnitsOfTypeToArmy(3, unitType1, army);
   6.196 +			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1);
   6.197 +			req.AddUnitTypeRequirement(unitType2, 2, 3);
   6.198 +			Unit unit = CreateUnitOfType(unitType1, army);
   6.199 +			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed));
   6.200 +			Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 2 × " + unitType2.Name + " for every 3 × " + unitType1.Name + " (would have 3 for 4)."));
   6.201 +		}
   6.202 +
   6.203 +		[Test()]
   6.204 +		public void TestAddingUnrelatedUnitWithNoUnitsAndTwoCombinedUnitTypesRequiredIsNA()
   6.205 +		{
   6.206 +			Army army = new Army(mockRace, "Test", 1000);
   6.207 +			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1);
   6.208 +			req.AddUnitTypeRequirement(unitType2, unitType3);
   6.209 +			Unit unit = CreateUnitOfType(unitType4, army);
   6.210 +			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.NotApplicable));
   6.211 +			Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.Empty);
   6.212 +		}
   6.213 +
   6.214 +		[Test()]
   6.215 +		public void TestAddingOneUnitWithTwoUnitTypeComboRequiredAndUnitOfOneTypePasses()
   6.216 +		{
   6.217 +			Army army = new Army(mockRace, "Test", 1000);
   6.218 +			AddUnitOfTypeToArmy(unitType2, army);
   6.219 +			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1);
   6.220 +			req.AddUnitTypeRequirement(unitType2, unitType3);
   6.221 +			Unit unit = CreateUnitOfType(unitType1, army);
   6.222 +			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Passed));
   6.223 +			Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.Empty);
   6.224 +		}
   6.225 +
   6.226 +		[Test()]
   6.227 +		public void TestAddingOneUnitWithTwoUnitTypeComboRequiredAndUnitOfOtherTypePasses()
   6.228 +		{
   6.229 +			Army army = new Army(mockRace, "Test", 1000);
   6.230 +			AddUnitOfTypeToArmy(unitType3, army);
   6.231 +			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1);
   6.232 +			req.AddUnitTypeRequirement(unitType2, unitType3);
   6.233 +			Unit unit = CreateUnitOfType(unitType1, army);
   6.234 +			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Passed));
   6.235 +			Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.Empty);
   6.236 +		}
   6.237 +
   6.238 +		[Test()]
   6.239 +		public void TestAddingTwoUnitsWithTwoUnitTypeComboRequiredAndOneUnitOfBothTypesPasses()
   6.240 +		{
   6.241 +			Army army = new Army(mockRace, "Test", 1000);
   6.242 +			AddUnitOfTypeToArmy(unitType3, army);
   6.243 +			AddUnitOfTypeToArmy(unitType2, army);
   6.244 +			AddUnitOfTypeToArmy(unitType1, army);
   6.245 +			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1);
   6.246 +			req.AddUnitTypeRequirement(unitType2, unitType3);
   6.247 +			Unit unit = CreateUnitOfType(unitType1, army);
   6.248 +			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Passed));
   6.249 +			Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.Empty);
   6.250 +		}
   6.251 +
   6.252 +		[Test()]
   6.253 +		public void TestAddingTwoUnitsWithTwoUnitTypeComboRequiredAndTwoUnitsOfOneTypePasses()
   6.254 +		{
   6.255 +			Army army = new Army(mockRace, "Test", 1000);
   6.256 +			AddUnitOfTypeToArmy(unitType3, army);
   6.257 +			AddUnitOfTypeToArmy(unitType3, army);
   6.258 +			AddUnitOfTypeToArmy(unitType1, army);
   6.259 +			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1);
   6.260 +			req.AddUnitTypeRequirement(unitType2, unitType3);
   6.261 +			Unit unit = CreateUnitOfType(unitType1, army);
   6.262 +			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Passed));
   6.263 +			Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.Empty);
   6.264 +		}
   6.265 +
   6.266 +		[Test()]
   6.267 +		public void TestAddingTwoUnitsWithTwoUnitTypeComboRequiredAndTwoUnitsOfOtherTypePasses()
   6.268 +		{
   6.269 +			Army army = new Army(mockRace, "Test", 1000);
   6.270 +			AddUnitOfTypeToArmy(unitType2, army);
   6.271 +			AddUnitOfTypeToArmy(unitType2, army);
   6.272 +			AddUnitOfTypeToArmy(unitType1, army);
   6.273 +			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1);
   6.274 +			req.AddUnitTypeRequirement(unitType2, unitType3);
   6.275 +			Unit unit = CreateUnitOfType(unitType1, army);
   6.276 +			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Passed));
   6.277 +			Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.Empty);
   6.278 +		}
   6.279 +
   6.280 +		[Test()]
   6.281 +		public void TestAddingThreeUnitsWithTwoUnitTypeComboRequiredAndOneUnitOfBothTypesFails()
   6.282 +		{
   6.283 +			Army army = new Army(mockRace, "Test", 1000);
   6.284 +			AddUnitOfTypeToArmy(unitType3, army);
   6.285 +			AddUnitOfTypeToArmy(unitType2, army);
   6.286 +			AddUnitOfTypeToArmy(unitType1, army);
   6.287 +			AddUnitOfTypeToArmy(unitType1, army);
   6.288 +			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1);
   6.289 +			req.AddUnitTypeRequirement(unitType2, unitType3);
   6.290 +			Unit unit = CreateUnitOfType(unitType1, army);
   6.291 +			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed));
   6.292 +			Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " or " + unitType3.Name + " for every 1 × " + unitType1.Name + " (would have 2 for 3)."));
   6.293 +		}
   6.294 +
   6.295 +		[Test()]
   6.296 +		public void TestAddingThreeUnitsWithTwoUnitTypeComboRequiredAndTwoUnitsOfOneTypeFails()
   6.297 +		{
   6.298 +			Army army = new Army(mockRace, "Test", 1000);
   6.299 +			AddUnitOfTypeToArmy(unitType3, army);
   6.300 +			AddUnitOfTypeToArmy(unitType3, army);
   6.301 +			AddUnitOfTypeToArmy(unitType1, army);
   6.302 +			AddUnitOfTypeToArmy(unitType1, army);
   6.303 +			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1);
   6.304 +			req.AddUnitTypeRequirement(unitType2, unitType3);
   6.305 +			Unit unit = CreateUnitOfType(unitType1, army);
   6.306 +			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed));
   6.307 +			Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " or " + unitType3.Name + " for every 1 × " + unitType1.Name + " (would have 2 for 3)."));
   6.308 +		}
   6.309 +
   6.310 +		[Test()]
   6.311 +		public void TestAddingThreeUnitsWithTwoUnitTypeComboRequiredAndTwoUnitsOfOtherTypeFails()
   6.312 +		{
   6.313 +			Army army = new Army(mockRace, "Test", 1000);
   6.314 +			AddUnitOfTypeToArmy(unitType2, army);
   6.315 +			AddUnitOfTypeToArmy(unitType2, army);
   6.316 +			AddUnitOfTypeToArmy(unitType1, army);
   6.317 +			AddUnitOfTypeToArmy(unitType1, army);
   6.318 +			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1);
   6.319 +			req.AddUnitTypeRequirement(unitType2, unitType3);
   6.320 +			Unit unit = CreateUnitOfType(unitType1, army);
   6.321 +			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed));
   6.322 +			Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " or " + unitType3.Name + " for every 1 × " + unitType1.Name + " (would have 2 for 3)."));
   6.323 +		}
   6.324 +
   6.325 +		[Test()]
   6.326 +		public void TestAddingUnrelatedUnitWithNoUnitsAndThreeForEachTwoCombinedUnitTypesRequiredIsNA()
   6.327 +		{
   6.328 +			Army army = new Army(mockRace, "Test", 1000);
   6.329 +			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1);
   6.330 +			req.AddUnitTypeRequirement(3, unitType2, unitType3);
   6.331 +			Unit unit = CreateUnitOfType(unitType4, army);
   6.332 +			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.NotApplicable));
   6.333 +			Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.Empty);
   6.334 +		}
   6.335 +
   6.336 +		[Test()]
   6.337 +		public void TestAddingThirdUnitWithThreeForEachTwoUnitTypeComboRequiredAndUnitOfOneTypePasses()
   6.338 +		{
   6.339 +			Army army = new Army(mockRace, "Test", 1000);
   6.340 +			AddUnitOfTypeToArmy(unitType2, army);
   6.341 +			AddUnitsOfTypeToArmy(2, unitType1, army);
   6.342 +			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1);
   6.343 +			req.AddUnitTypeRequirement(3, unitType2, unitType3);
   6.344 +			Unit unit = CreateUnitOfType(unitType1, army);
   6.345 +			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Passed));
   6.346 +			Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.Empty);
   6.347 +		}
   6.348 +
   6.349 +		[Test()]
   6.350 +		public void TestAddingThirdUnitWithThreeForEachTwoUnitTypeComboRequiredAndUnitOfOtherTypePasses()
   6.351 +		{
   6.352 +			Army army = new Army(mockRace, "Test", 1000);
   6.353 +			AddUnitOfTypeToArmy(unitType3, army);
   6.354 +			AddUnitsOfTypeToArmy(2, unitType1, army);
   6.355 +			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1);
   6.356 +			req.AddUnitTypeRequirement(3, unitType2, unitType3);
   6.357 +			Unit unit = CreateUnitOfType(unitType1, army);
   6.358 +			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Passed));
   6.359 +			Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.Empty);
   6.360 +		}
   6.361 +
   6.362 +		[Test()]
   6.363 +		public void TestAddingSixthUnitWithThreeForEachTwoUnitTypeComboRequiredAndOneUnitOfBothTypesPasses()
   6.364 +		{
   6.365 +			Army army = new Army(mockRace, "Test", 1000);
   6.366 +			AddUnitOfTypeToArmy(unitType3, army);
   6.367 +			AddUnitOfTypeToArmy(unitType2, army);
   6.368 +			AddUnitsOfTypeToArmy(5, unitType1, army);
   6.369 +			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1);
   6.370 +			req.AddUnitTypeRequirement(3, unitType2, unitType3);
   6.371 +			Unit unit = CreateUnitOfType(unitType1, army);
   6.372 +			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Passed));
   6.373 +			Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.Empty);
   6.374 +		}
   6.375 +
   6.376 +		[Test()]
   6.377 +		public void TestAddingSixthUnitWithThreeForEachTwoUnitTypeComboRequiredAndTwoUnitsOfOneTypePasses()
   6.378 +		{
   6.379 +			Army army = new Army(mockRace, "Test", 1000);
   6.380 +			AddUnitsOfTypeToArmy(2, unitType3, army);
   6.381 +			AddUnitsOfTypeToArmy(5, unitType1, army);
   6.382 +			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1);
   6.383 +			req.AddUnitTypeRequirement(3, unitType2, unitType3);
   6.384 +			Unit unit = CreateUnitOfType(unitType1, army);
   6.385 +			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Passed));
   6.386 +			Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.Empty);
   6.387 +		}
   6.388 +
   6.389 +		[Test()]
   6.390 +		public void TestAddingSixthUnitWithThreeForEachTwoUnitTypeComboRequiredAndTwoUnitsOfOtherTypePasses()
   6.391 +		{
   6.392 +			Army army = new Army(mockRace, "Test", 1000);
   6.393 +			AddUnitsOfTypeToArmy(2, unitType2, army);
   6.394 +			AddUnitsOfTypeToArmy(5, unitType1, army);
   6.395 +			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1);
   6.396 +			req.AddUnitTypeRequirement(3, unitType2, unitType3);
   6.397 +			Unit unit = CreateUnitOfType(unitType1, army);
   6.398 +			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Passed));
   6.399 +			Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.Empty);
   6.400 +		}
   6.401 +
   6.402 +		[Test()]
   6.403 +		public void TestAddingSevenUnitsWithThreeForEachTwoUnitTypeComboRequiredAndOneUnitOfBothTypesFails()
   6.404 +		{
   6.405 +			Army army = new Army(mockRace, "Test", 1000);
   6.406 +			AddUnitOfTypeToArmy(unitType3, army);
   6.407 +			AddUnitOfTypeToArmy(unitType2, army);
   6.408 +			AddUnitsOfTypeToArmy(6, unitType1, army);
   6.409 +			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1);
   6.410 +			req.AddUnitTypeRequirement(3, unitType2, unitType3);
   6.411 +			Unit unit = CreateUnitOfType(unitType1, army);
   6.412 +			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed));
   6.413 +			Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " or " + unitType3.Name + " for every 3 × " + unitType1.Name + " (would have 2 for 7)."));
   6.414 +		}
   6.415 +
   6.416 +		[Test()]
   6.417 +		public void TestAddingSevenUnitsWithThreeForEachTwoUnitTypeComboRequiredAndTwoUnitsOfOneTypeFails()
   6.418 +		{
   6.419 +			Army army = new Army(mockRace, "Test", 1000);
   6.420 +			AddUnitsOfTypeToArmy(2, unitType3, army);
   6.421 +			AddUnitsOfTypeToArmy(6, unitType1, army);
   6.422 +			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1);
   6.423 +			req.AddUnitTypeRequirement(3, unitType2, unitType3);
   6.424 +			Unit unit = CreateUnitOfType(unitType1, army);
   6.425 +			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed));
   6.426 +			Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " or " + unitType3.Name + " for every 3 × " + unitType1.Name + " (would have 2 for 7)."));
   6.427 +		}
   6.428 +
   6.429 +		[Test()]
   6.430 +		public void TestAddingSevenUnitsWithThreeForEachTwoUnitTypeComboRequiredAndTwoUnitsOfOtherTypeFails()
   6.431 +		{
   6.432 +			Army army = new Army(mockRace, "Test", 1000);
   6.433 +			AddUnitsOfTypeToArmy(2, unitType2, army);
   6.434 +			AddUnitsOfTypeToArmy(6, unitType1, army);
   6.435 +			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1);
   6.436 +			req.AddUnitTypeRequirement(3, unitType2, unitType3);
   6.437 +			Unit unit = CreateUnitOfType(unitType1, army);
   6.438 +			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed));
   6.439 +			Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " or " + unitType3.Name + " for every 3 × " + unitType1.Name + " (would have 2 for 7)."));
   6.440 +		}
   6.441 +
   6.442 +		[Test()]
   6.443 +		public void TestValidatingArmyWithNoUnitsAndOneUnitTypeRequiredIsNA()
   6.444 +		{
   6.445 +			Army army = new Army(mockRace, "Test", 1000);
   6.446 +			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1, unitType2);
   6.447 +			Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.NotApplicable));
   6.448 +			Assert.That(req.GetValidationMessage(army), Is.Empty);
   6.449 +		}
   6.450 +
   6.451 +		[Test()]
   6.452 +		public void TestValidatingArmyWithOneUnitTypeRequiredAndOneUnitOfTypePasses()
   6.453 +		{
   6.454 +			Army army = new Army(mockRace, "Test", 1000);
   6.455 +			AddUnitOfTypeToArmy(unitType2, army);
   6.456 +			AddUnitOfTypeToArmy(unitType1, army);
   6.457 +			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1, unitType2);
   6.458 +			Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Passed));
   6.459 +			Assert.That(req.GetValidationMessage(army), Is.Empty);
   6.460 +		}
   6.461 +
   6.462 +		[Test()]
   6.463 +		public void TestValidatingArmyWithOneUnitTypeRequiredAndNoUnitOfTypeFails()
   6.464 +		{
   6.465 +			Army army = new Army(mockRace, "Test", 1000);
   6.466 +			AddUnitOfTypeToArmy(unitType1, army);
   6.467 +			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1, unitType2);
   6.468 +			Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Failed));
   6.469 +			Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " for every 1 × " + unitType1.Name + " (have 0 for 1)."));
   6.470 +		}
   6.471 +
   6.472 +		[Test()]
   6.473 +		public void TestValidatingArmyWithTwoDifferentUnitTypesRequiredAndNoUnitOfOneTypeFails()
   6.474 +		{
   6.475 +			Army army = new Army(mockRace, "Test", 1000);
   6.476 +			AddUnitOfTypeToArmy(unitType2, army);
   6.477 +			AddUnitOfTypeToArmy(unitType1, army);
   6.478 +			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1);
   6.479 +			req.AddUnitTypeRequirement(unitType2);
   6.480 +			req.AddUnitTypeRequirement(unitType3);
   6.481 +			Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Failed));
   6.482 +			Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 1 × " + unitType3.Name + " for every 1 × " + unitType1.Name + " (have 0 for 1)."));
   6.483 +		}
   6.484 +
   6.485 +		[Test()]
   6.486 +		public void TestValidatingArmyWithTwoUnitsAndOneUnitTypeRequiredAndOneUnitOfTypeFails()
   6.487 +		{
   6.488 +			Army army = new Army(mockRace, "Test", 1000);
   6.489 +			AddUnitOfTypeToArmy(unitType2, army);
   6.490 +			AddUnitOfTypeToArmy(unitType1, army);
   6.491 +			AddUnitOfTypeToArmy(unitType1, army);
   6.492 +			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1, unitType2);
   6.493 +			Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Failed));
   6.494 +			Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " for every 1 × " + unitType1.Name + " (have 1 for 2)."));
   6.495 +		}
   6.496 +
   6.497 +		[Test()]
   6.498 +		public void TestValidatingArmyWithTwoUnitsAndTwoOfUnitTypeAllowedForOneUnitTypeRequiredAndOneUnitOfTypePasses()
   6.499 +		{
   6.500 +			Army army = new Army(mockRace, "Test", 1000);
   6.501 +			AddUnitOfTypeToArmy(unitType2, army);
   6.502 +			AddUnitOfTypeToArmy(unitType1, army);
   6.503 +			AddUnitOfTypeToArmy(unitType1, army);
   6.504 +			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1);
   6.505 +			req.AddUnitTypeRequirement(unitType2, 1, 2);
   6.506 +			Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Passed));
   6.507 +			Assert.That(req.GetValidationMessage(army), Is.Empty);
   6.508 +		}
   6.509 +
   6.510 +		[Test()]
   6.511 +		public void TestValidatingArmyWithTwoUnitsWithTwoAllowedAndOneAllowedForDifferentTypesFails()
   6.512 +		{
   6.513 +			Army army = new Army(mockRace, "Test", 1000);
   6.514 +			AddUnitOfTypeToArmy(unitType2, army);
   6.515 +			AddUnitOfTypeToArmy(unitType3, army);
   6.516 +			AddUnitOfTypeToArmy(unitType1, army);
   6.517 +			AddUnitOfTypeToArmy(unitType1, army);
   6.518 +			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1);
   6.519 +			req.AddUnitTypeRequirement(unitType2, 1, 2);
   6.520 +			req.AddUnitTypeRequirement(unitType3, 1, 1);
   6.521 +			Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Failed));
   6.522 +			Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 1 × " + unitType3.Name + " for every 1 × " + unitType1.Name + " (have 1 for 2)."));
   6.523 +		}
   6.524 +
   6.525 +		[Test()]
   6.526 +		public void TestValidatingArmyWithTwoUnitsWithOneAllowedForTwoTypesFails()
   6.527 +		{
   6.528 +			Army army = new Army(mockRace, "Test", 1000);
   6.529 +			AddUnitOfTypeToArmy(unitType2, army);
   6.530 +			AddUnitOfTypeToArmy(unitType3, army);
   6.531 +			AddUnitOfTypeToArmy(unitType1, army);
   6.532 +			AddUnitOfTypeToArmy(unitType1, army);
   6.533 +			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1);
   6.534 +			req.AddUnitTypeRequirement(unitType2, 1, 1);
   6.535 +			req.AddUnitTypeRequirement(unitType3, 1, 1);
   6.536 +			Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Failed));
   6.537 +			Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " for every 1 × " + unitType1.Name + " (have 1 for 2); 1 × " + unitType3.Name + " for every 1 × " + unitType1.Name + " (have 1 for 2)."));
   6.538 +		}
   6.539 +
   6.540 +		[Test()]
   6.541 +		public void TestValidatingArmyWithTwoUnitsWithOneAllowedForTwoTypesFails_ShorthandMethod()
   6.542 +		{
   6.543 +			Army army = new Army(mockRace, "Test", 1000);
   6.544 +			AddUnitOfTypeToArmy(unitType2, army);
   6.545 +			AddUnitOfTypeToArmy(unitType3, army);
   6.546 +			AddUnitOfTypeToArmy(unitType1, army);
   6.547 +			AddUnitOfTypeToArmy(unitType1, army);
   6.548 +			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1, unitType2, unitType3);
   6.549 +			Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Failed));
   6.550 +			Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " for every 1 × " + unitType1.Name + " (have 1 for 2); 1 × " + unitType3.Name + " for every 1 × " + unitType1.Name + " (have 1 for 2)."));
   6.551 +		}
   6.552 +
   6.553 +		[Test()]
   6.554 +		public void TestValidatingArmyWithOneUnitWithThreeOfUnitTypeAllowedForTwoOfUnitTypeRequiredAndOneUnitOfTypeFails()
   6.555 +		{
   6.556 +			Army army = new Army(mockRace, "Test", 1000);
   6.557 +			AddUnitOfTypeToArmy(unitType2, army);
   6.558 +			AddUnitOfTypeToArmy(unitType1, army);
   6.559 +			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1);
   6.560 +			req.AddUnitTypeRequirement(unitType2, 2, 3);
   6.561 +			Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Failed));
   6.562 +			Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 2 × " + unitType2.Name + " for every 3 × " + unitType1.Name + " (have 1 for 1)."));
   6.563 +		}
   6.564 +
   6.565 +		[Test()]
   6.566 +		public void TestValidatingArmyWithTwoUnitsWithThreeOfUnitTypeAllowedForTwoOfUnitTypeRequiredAndOneUnitOfTypeFails()
   6.567 +		{
   6.568 +			Army army = new Army(mockRace, "Test", 1000);
   6.569 +			AddUnitOfTypeToArmy(unitType2, army);
   6.570 +			AddUnitsOfTypeToArmy(2, unitType1, army);
   6.571 +			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1);
   6.572 +			req.AddUnitTypeRequirement(unitType2, 2, 3);
   6.573 +			Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Failed));
   6.574 +			Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 2 × " + unitType2.Name + " for every 3 × " + unitType1.Name + " (have 1 for 2)."));
   6.575 +		}
   6.576 +
   6.577 +		[Test()]
   6.578 +		public void TestValidatingArmyWithFourUnitsWithThreeOfUnitTypeAllowedForTwoOfUnitTypeRequiredAndThreeUnitsOfTypeFails()
   6.579 +		{
   6.580 +			Army army = new Army(mockRace, "Test", 1000);
   6.581 +			AddUnitsOfTypeToArmy(3, unitType2, army);
   6.582 +			AddUnitsOfTypeToArmy(4, unitType1, army);
   6.583 +			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1);
   6.584 +			req.AddUnitTypeRequirement(unitType2, 2, 3);
   6.585 +			Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Failed));
   6.586 +			Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 2 × " + unitType2.Name + " for every 3 × " + unitType1.Name + " (have 3 for 4)."));
   6.587 +		}
   6.588 +
   6.589 +		[Test()]
   6.590 +		public void TestValidatingArmyWithThreeUnitsAndTwoOfUnitTypeAllowedForOneUnitTypeRequiredAndOneUnitOfTypeFails()
   6.591 +		{
   6.592 +			Army army = new Army(mockRace, "Test", 1000);
   6.593 +			AddUnitOfTypeToArmy(unitType2, army);
   6.594 +			AddUnitOfTypeToArmy(unitType1, army);
   6.595 +			AddUnitOfTypeToArmy(unitType1, army);
   6.596 +			AddUnitOfTypeToArmy(unitType1, army);
   6.597 +			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1);
   6.598 +			req.AddUnitTypeRequirement(unitType2, 1, 2);
   6.599 +			Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Failed));
   6.600 +			Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " for every 2 × " + unitType1.Name + " (have 1 for 3)."));
   6.601 +		}
   6.602 +
   6.603 +		[Test()]
   6.604 +		public void TestValidatingArmyWithNoUnitsAndThreeForEachTwoCombinedUnitTypesRequiredIsNA()
   6.605 +		{
   6.606 +			Army army = new Army(mockRace, "Test", 1000);
   6.607 +			AddUnitOfTypeToArmy(unitType4, army);
   6.608 +			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1);
   6.609 +			req.AddUnitTypeRequirement(3, unitType2, unitType3);
   6.610 +			Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.NotApplicable));
   6.611 +			Assert.That(req.GetValidationMessage(army), Is.Empty);
   6.612 +		}
   6.613 +
   6.614 +		[Test()]
   6.615 +		public void TestValidatingArmyWithThreeUnitsWithThreeForEachTwoUnitTypeComboRequiredAndUnitOfOneTypePasses()
   6.616 +		{
   6.617 +			Army army = new Army(mockRace, "Test", 1000);
   6.618 +			AddUnitOfTypeToArmy(unitType2, army);
   6.619 +			AddUnitsOfTypeToArmy(3, unitType1, army);
   6.620 +			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1);
   6.621 +			req.AddUnitTypeRequirement(3, unitType2, unitType3);
   6.622 +			Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Passed));
   6.623 +			Assert.That(req.GetValidationMessage(army), Is.Empty);
   6.624 +		}
   6.625 +
   6.626 +		[Test()]
   6.627 +		public void TestValidatingArmyWithThreeUnitsWithThreeForEachTwoUnitTypeComboRequiredAndUnitOfOtherTypePasses()
   6.628 +		{
   6.629 +			Army army = new Army(mockRace, "Test", 1000);
   6.630 +			AddUnitOfTypeToArmy(unitType3, army);
   6.631 +			AddUnitsOfTypeToArmy(3, unitType1, army);
   6.632 +			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1);
   6.633 +			req.AddUnitTypeRequirement(3, unitType2, unitType3);
   6.634 +			Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Passed));
   6.635 +			Assert.That(req.GetValidationMessage(army), Is.Empty);
   6.636 +		}
   6.637 +
   6.638 +		[Test()]
   6.639 +		public void TestValidatingArmyWithSixUnitsWithThreeForEachTwoUnitTypeComboRequiredAndOneUnitOfBothTypesPasses()
   6.640 +		{
   6.641 +			Army army = new Army(mockRace, "Test", 1000);
   6.642 +			AddUnitOfTypeToArmy(unitType3, army);
   6.643 +			AddUnitOfTypeToArmy(unitType2, army);
   6.644 +			AddUnitsOfTypeToArmy(6, unitType1, army);
   6.645 +			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1);
   6.646 +			req.AddUnitTypeRequirement(3, unitType2, unitType3);
   6.647 +			Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Passed));
   6.648 +			Assert.That(req.GetValidationMessage(army), Is.Empty);
   6.649 +		}
   6.650 +
   6.651 +		[Test()]
   6.652 +		public void TestValidatingArmyWithSixUnitsWithThreeForEachTwoUnitTypeComboRequiredAndTwoUnitsOfOneTypePasses()
   6.653 +		{
   6.654 +			Army army = new Army(mockRace, "Test", 1000);
   6.655 +			AddUnitsOfTypeToArmy(2, unitType3, army);
   6.656 +			AddUnitsOfTypeToArmy(6, unitType1, army);
   6.657 +			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1);
   6.658 +			req.AddUnitTypeRequirement(3, unitType2, unitType3);
   6.659 +			Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Passed));
   6.660 +			Assert.That(req.GetValidationMessage(army), Is.Empty);
   6.661 +		}
   6.662 +
   6.663 +		[Test()]
   6.664 +		public void TestValidatingArmyWithSixUnitsWithThreeForEachTwoUnitTypeComboRequiredAndTwoUnitsOfOtherTypePasses()
   6.665 +		{
   6.666 +			Army army = new Army(mockRace, "Test", 1000);
   6.667 +			AddUnitsOfTypeToArmy(2, unitType2, army);
   6.668 +			AddUnitsOfTypeToArmy(6, unitType1, army);
   6.669 +			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1);
   6.670 +			req.AddUnitTypeRequirement(3, unitType2, unitType3);
   6.671 +			Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Passed));
   6.672 +			Assert.That(req.GetValidationMessage(army), Is.Empty);
   6.673 +		}
   6.674 +
   6.675 +		[Test()]
   6.676 +		public void TestValidatingArmyWithSevenUnitsWithThreeForEachTwoUnitTypeComboRequiredAndOneUnitOfBothTypesFails()
   6.677 +		{
   6.678 +			Army army = new Army(mockRace, "Test", 1000);
   6.679 +			AddUnitOfTypeToArmy(unitType3, army);
   6.680 +			AddUnitOfTypeToArmy(unitType2, army);
   6.681 +			AddUnitsOfTypeToArmy(7, unitType1, army);
   6.682 +			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1);
   6.683 +			req.AddUnitTypeRequirement(3, unitType2, unitType3);
   6.684 +			Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Failed));
   6.685 +			Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " or " + unitType3.Name + " for every 3 × " + unitType1.Name + " (have 2 for 7)."));
   6.686 +		}
   6.687 +
   6.688 +		[Test()]
   6.689 +		public void TestValidatingArmyWithSevenUnitsWithThreeForEachTwoUnitTypeComboRequiredAndTwoUnitsOfOneTypeFails()
   6.690 +		{
   6.691 +			Army army = new Army(mockRace, "Test", 1000);
   6.692 +			AddUnitsOfTypeToArmy(2, unitType3, army);
   6.693 +			AddUnitsOfTypeToArmy(7, unitType1, army);
   6.694 +			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1);
   6.695 +			req.AddUnitTypeRequirement(3, unitType2, unitType3);
   6.696 +			Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Failed));
   6.697 +			Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " or " + unitType3.Name + " for every 3 × " + unitType1.Name + " (have 2 for 7)."));
   6.698 +		}
   6.699 +
   6.700 +		[Test()]
   6.701 +		public void TestValidatingArmyWithSevenUnitsWithThreeForEachTwoUnitTypeComboRequiredAndTwoUnitsOfOtherTypeFails()
   6.702 +		{
   6.703 +			Army army = new Army(mockRace, "Test", 1000);
   6.704 +			AddUnitsOfTypeToArmy(2, unitType2, army);
   6.705 +			AddUnitsOfTypeToArmy(7, unitType1, army);
   6.706 +			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1);
   6.707 +			req.AddUnitTypeRequirement(3, unitType2, unitType3);
   6.708 +			Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Failed));
   6.709 +			Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " or " + unitType3.Name + " for every 3 × " + unitType1.Name + " (have 2 for 7)."));
   6.710 +		}
   6.711 +
   6.712 +		private static void AddUnitsOfTypeToArmy(int count, UnitType unitType, Army army)
   6.713 +		{
   6.714 +			for (int i = 0; i < count; i++)
   6.715 +			{
   6.716 +				AddUnitOfTypeToArmy(unitType, army);
   6.717 +			}
   6.718 +		}
   6.719 +
   6.720 +		private static void AddUnitOfTypeToArmy(UnitType unitType, Army army)
   6.721 +		{
   6.722 +			army.AddUnit(CreateUnitOfType(unitType, army));
   6.723 +		}
   6.724 +
   6.725 +		private static Unit CreateUnitOfType(UnitType unitType, Army army)
   6.726 +		{
   6.727 +			return new Unit(unitType, army.GetCategory(unitType.MainCategory));
   6.728 +		}
   6.729 +
   6.730 +		public override RequiresNUnitsForMObjectsRequirement<UnitType> GetObject()
   6.731 +		{
   6.732 +			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType3);
   6.733 +			req.AddUnitTypeRequirement(unitType1, 2, 3);
   6.734 +			return req;
   6.735 +		}
   6.736 +
   6.737 +		public override RequiresNUnitsForMObjectsRequirement<UnitType> GetSameObject()
   6.738 +		{
   6.739 +			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType3);
   6.740 +			req.AddUnitTypeRequirement(unitType1, 2, 3);
   6.741 +			return req;
   6.742 +		}
   6.743 +
   6.744 +		public override RequiresNUnitsForMObjectsRequirement<UnitType> GetDifferentObject()
   6.745 +		{
   6.746 +			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType3);
   6.747 +			DummyWarFoundryFactory factory = new DummyWarFoundryFactory();
   6.748 +			GameSystem gameSystem = new GameSystem("system", "system", factory);
   6.749 +			Race race = new Race("race", "race", gameSystem, factory);
   6.750 +			req.AddUnitTypeRequirement(new UnitType("id2", "Type 2", race), 2, 3);
   6.751 +			return req;
   6.752 +		}
   6.753 +
   6.754 +		protected abstract RequiresNUnitsForMObjectsRequirement<UnitType> CreateRequirement(UnitType allowedType, params UnitType[] requiredUnitTypes);
   6.755 +	}
   6.756 +}
   6.757 +
     7.1 --- a/API/Objects/Requirement/RequiresNUnitsForMUnitsRequirementTest.cs	Tue Jan 31 20:59:15 2012 +0000
     7.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.3 @@ -1,753 +0,0 @@
     7.4 -// This file (UnitRequiresNUnitsForMUnitsRequirement.cs) is a part of the IBBoard.WarFoundry.API.Tests project and is copyright 2011 IBBoard
     7.5 -// 
     7.6 -// 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.
     7.7 -using System;
     7.8 -using NUnit.Framework;
     7.9 -using IBBoard.WarFoundry.API.Objects.Mock;
    7.10 -using NUnit.Framework.SyntaxHelpers;
    7.11 -using System.Reflection;
    7.12 -using IBBoard.NUnit;
    7.13 -using IBBoard.WarFoundry.API.Factories;
    7.14 -
    7.15 -namespace IBBoard.WarFoundry.API.Objects.Requirement
    7.16 -{
    7.17 -	[TestFixture()]
    7.18 -	public class RequiresNUnitsForMUnitsRequirementTest : AbstractEqualityTest<RequiresNUnitsForMUnitsRequirement>
    7.19 -	{
    7.20 -		private MockRace mockRace;
    7.21 -		private UnitType unitType1;
    7.22 -		private UnitType unitType2;
    7.23 -		private UnitType unitType3;
    7.24 -		private UnitType unitType4;
    7.25 -
    7.26 -		[TestFixtureSetUp()]
    7.27 -		public void SetupRace()
    7.28 -		{
    7.29 -			mockRace = MockRace.GetMockRace();
    7.30 -			unitType1 = new MockUnitType("type1", "Unit Type 1");
    7.31 -			mockRace.AddUnitType(unitType1);
    7.32 -			unitType2 = new MockUnitType("type2", "Unit Type 2");
    7.33 -			mockRace.AddUnitType(unitType2);
    7.34 -			unitType3 = new MockUnitType("type3", "Unit Type 3");
    7.35 -			mockRace.AddUnitType(unitType3);
    7.36 -			unitType4 = new MockUnitType("type4", "Unit Type 4");
    7.37 -			mockRace.AddUnitType(unitType4);
    7.38 -		}
    7.39 -
    7.40 -		[Test()]
    7.41 -		public void TestAddingUnrelatedUnitWithNoUnitsAndOneUnitTypeRequiredIsNA()
    7.42 -		{
    7.43 -			Army army = new Army(mockRace, "Test", 1000);
    7.44 -			RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1, unitType2);
    7.45 -			Unit unit = CreateUnitOfType(unitType3, army);
    7.46 -			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.NotApplicable));
    7.47 -			Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.Empty);
    7.48 -		}
    7.49 -
    7.50 -		[Test()]
    7.51 -		public void TestAddingOneUnitWithOneUnitTypeRequiredAndOneUnitOfTypePasses()
    7.52 -		{
    7.53 -			Army army = new Army(mockRace, "Test", 1000);
    7.54 -			AddUnitOfTypeToArmy(unitType2, army);
    7.55 -			RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1, unitType2);
    7.56 -			Unit unit = CreateUnitOfType(unitType1, army);
    7.57 -			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Passed));
    7.58 -			Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.Empty);
    7.59 -		}
    7.60 -
    7.61 -		[Test()]
    7.62 -		public void TestAddingOneUnitWithOneUnitTypeRequiredAndNoUnitOfTypeFails()
    7.63 -		{
    7.64 -			Army army = new Army(mockRace, "Test", 1000);
    7.65 -			RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1, unitType2);
    7.66 -			Unit unit = CreateUnitOfType(unitType1, army);
    7.67 -			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed));
    7.68 -			Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " for every 1 × " + unitType1.Name + " (would have 0 for 1)."));
    7.69 -		}
    7.70 -
    7.71 -		[Test()]
    7.72 -		public void TestAddingOneUnitWithTwoDifferentUnitTypesRequiredAndNoUnitOfOneTypeFails()
    7.73 -		{
    7.74 -			Army army = new Army(mockRace, "Test", 1000);
    7.75 -			AddUnitOfTypeToArmy(unitType2, army);
    7.76 -			RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1);
    7.77 -			req.AddUnitTypeRequirement(unitType2);
    7.78 -			req.AddUnitTypeRequirement(unitType3);
    7.79 -			Unit unit = CreateUnitOfType(unitType1, army);
    7.80 -			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed));
    7.81 -			Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 1 × " + unitType3.Name + " for every 1 × " + unitType1.Name + " (would have 0 for 1)."));
    7.82 -		}
    7.83 -
    7.84 -		[Test()]
    7.85 -		public void TestAddingTwoUnitsWithOneUnitTypeRequiredAndOneUnitOfTypeFails()
    7.86 -		{
    7.87 -			Army army = new Army(mockRace, "Test", 1000);
    7.88 -			AddUnitOfTypeToArmy(unitType2, army);
    7.89 -			AddUnitOfTypeToArmy(unitType1, army);
    7.90 -			RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1, unitType2);
    7.91 -			Unit unit = CreateUnitOfType(unitType1, army);
    7.92 -			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed));
    7.93 -			Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " for every 1 × " + unitType1.Name + " (would have 1 for 2)."));
    7.94 -		}
    7.95 -
    7.96 -		[Test()]
    7.97 -		public void TestAddingTwoUnitsWithTwoOfUnitTypeAllowedForOneUnitTypeRequiredAndOneUnitOfTypePasses()
    7.98 -		{
    7.99 -			Army army = new Army(mockRace, "Test", 1000);
   7.100 -			AddUnitOfTypeToArmy(unitType2, army);
   7.101 -			AddUnitOfTypeToArmy(unitType1, army);
   7.102 -			RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1);
   7.103 -			req.AddUnitTypeRequirement(unitType2, 1, 2);
   7.104 -			Unit unit = CreateUnitOfType(unitType1, army);
   7.105 -			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Passed));
   7.106 -			Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.Empty);
   7.107 -		}
   7.108 -
   7.109 -		[Test()]
   7.110 -		public void TestAddingTwoUnitsWithTwoAllowedAndOneAllowedForDifferentTypesFails()
   7.111 -		{
   7.112 -			Army army = new Army(mockRace, "Test", 1000);
   7.113 -			AddUnitOfTypeToArmy(unitType2, army);
   7.114 -			AddUnitOfTypeToArmy(unitType3, army);
   7.115 -			AddUnitOfTypeToArmy(unitType1, army);
   7.116 -			RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1);
   7.117 -			req.AddUnitTypeRequirement(unitType2, 1, 2);
   7.118 -			req.AddUnitTypeRequirement(unitType3, 1, 1);
   7.119 -			Unit unit = CreateUnitOfType(unitType1, army);
   7.120 -			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed));
   7.121 -			Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 1 × " + unitType3.Name + " for every 1 × " + unitType1.Name + " (would have 1 for 2)."));
   7.122 -		}
   7.123 -
   7.124 -		[Test()]
   7.125 -		public void TestAddingSecondUnitsWithOneAllowedForTwoTypesFails()
   7.126 -		{
   7.127 -			Army army = new Army(mockRace, "Test", 1000);
   7.128 -			AddUnitOfTypeToArmy(unitType2, army);
   7.129 -			AddUnitOfTypeToArmy(unitType3, army);
   7.130 -			AddUnitOfTypeToArmy(unitType1, army);
   7.131 -			RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1);
   7.132 -			req.AddUnitTypeRequirement(unitType2, 1, 1);
   7.133 -			req.AddUnitTypeRequirement(unitType3, 1, 1);
   7.134 -			Unit unit = CreateUnitOfType(unitType1, army);
   7.135 -			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed));
   7.136 -			Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " for every 1 × " + unitType1.Name + " (would have 1 for 2); 1 × " + unitType3.Name + " for every 1 × " + unitType1.Name + " (would have 1 for 2)."));
   7.137 -		}
   7.138 -
   7.139 -		[Test()]
   7.140 -		public void TestAddingSecondUnitsWithOneAllowedForTwoTypesFails_ShorthandMethod()
   7.141 -		{
   7.142 -			Army army = new Army(mockRace, "Test", 1000);
   7.143 -			AddUnitOfTypeToArmy(unitType2, army);
   7.144 -			AddUnitOfTypeToArmy(unitType3, army);
   7.145 -			AddUnitOfTypeToArmy(unitType1, army);
   7.146 -			RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1, unitType2, unitType3);
   7.147 -			Unit unit = CreateUnitOfType(unitType1, army);
   7.148 -			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed));
   7.149 -			Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " for every 1 × " + unitType1.Name + " (would have 1 for 2); 1 × " + unitType3.Name + " for every 1 × " + unitType1.Name + " (would have 1 for 2)."));
   7.150 -		}
   7.151 -
   7.152 -		[Test()]
   7.153 -		public void TestAddingThreeUnitsWithTwoOfUnitTypeAllowedForOneUnitTypeRequiredAndOneUnitOfTypeFails()
   7.154 -		{
   7.155 -			Army army = new Army(mockRace, "Test", 1000);
   7.156 -			AddUnitOfTypeToArmy(unitType2, army);
   7.157 -			AddUnitOfTypeToArmy(unitType1, army);
   7.158 -			AddUnitOfTypeToArmy(unitType1, army);
   7.159 -			RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1);
   7.160 -			req.AddUnitTypeRequirement(unitType2, 1, 2);
   7.161 -			Unit unit = CreateUnitOfType(unitType1, army);
   7.162 -			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed));
   7.163 -			Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " for every 2 × " + unitType1.Name + " (would have 1 for 3)."));
   7.164 -		}
   7.165 -
   7.166 -		[Test()]
   7.167 -		public void TestAddingOneUnitWithThreeOfUnitTypeAllowedForTwoOfUnitTypeRequiredAndOneUnitOfTypeFails()
   7.168 -		{
   7.169 -			Army army = new Army(mockRace, "Test", 1000);
   7.170 -			AddUnitOfTypeToArmy(unitType2, army);
   7.171 -			RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1);
   7.172 -			req.AddUnitTypeRequirement(unitType2, 2, 3);
   7.173 -			Unit unit = CreateUnitOfType(unitType1, army);
   7.174 -			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed));
   7.175 -			Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 2 × " + unitType2.Name + " for every 3 × " + unitType1.Name + " (would have 1 for 1)."));
   7.176 -		}
   7.177 -
   7.178 -		[Test()]
   7.179 -		public void TestAddingSecondUnitWithThreeOfUnitTypeAllowedForTwoOfUnitTypeRequiredAndOneUnitOfTypeFails()
   7.180 -		{
   7.181 -			Army army = new Army(mockRace, "Test", 1000);
   7.182 -			AddUnitOfTypeToArmy(unitType2, army);
   7.183 -			AddUnitOfTypeToArmy(unitType1, army);
   7.184 -			RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1);
   7.185 -			req.AddUnitTypeRequirement(unitType2, 2, 3);
   7.186 -			Unit unit = CreateUnitOfType(unitType1, army);
   7.187 -			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed));
   7.188 -			Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 2 × " + unitType2.Name + " for every 3 × " + unitType1.Name + " (would have 1 for 2)."));
   7.189 -		}
   7.190 -
   7.191 -		[Test()]
   7.192 -		public void TestAddingFourthUnitWithThreeOfUnitTypeAllowedForTwoOfUnitTypeRequiredAndThreeUnitsOfTypeFails()
   7.193 -		{
   7.194 -			Army army = new Army(mockRace, "Test", 1000);
   7.195 -			AddUnitsOfTypeToArmy(3, unitType2, army);
   7.196 -			AddUnitsOfTypeToArmy(3, unitType1, army);
   7.197 -			RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1);
   7.198 -			req.AddUnitTypeRequirement(unitType2, 2, 3);
   7.199 -			Unit unit = CreateUnitOfType(unitType1, army);
   7.200 -			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed));
   7.201 -			Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 2 × " + unitType2.Name + " for every 3 × " + unitType1.Name + " (would have 3 for 4)."));
   7.202 -		}
   7.203 -
   7.204 -		[Test()]
   7.205 -		public void TestAddingUnrelatedUnitWithNoUnitsAndTwoCombinedUnitTypesRequiredIsNA()
   7.206 -		{
   7.207 -			Army army = new Army(mockRace, "Test", 1000);
   7.208 -			RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1);
   7.209 -			req.AddUnitTypeRequirement(unitType2, unitType3);
   7.210 -			Unit unit = CreateUnitOfType(unitType4, army);
   7.211 -			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.NotApplicable));
   7.212 -			Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.Empty);
   7.213 -		}
   7.214 -
   7.215 -		[Test()]
   7.216 -		public void TestAddingOneUnitWithTwoUnitTypeComboRequiredAndUnitOfOneTypePasses()
   7.217 -		{
   7.218 -			Army army = new Army(mockRace, "Test", 1000);
   7.219 -			AddUnitOfTypeToArmy(unitType2, army);
   7.220 -			RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1);
   7.221 -			req.AddUnitTypeRequirement(unitType2, unitType3);
   7.222 -			Unit unit = CreateUnitOfType(unitType1, army);
   7.223 -			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Passed));
   7.224 -			Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.Empty);
   7.225 -		}
   7.226 -
   7.227 -		[Test()]
   7.228 -		public void TestAddingOneUnitWithTwoUnitTypeComboRequiredAndUnitOfOtherTypePasses()
   7.229 -		{
   7.230 -			Army army = new Army(mockRace, "Test", 1000);
   7.231 -			AddUnitOfTypeToArmy(unitType3, army);
   7.232 -			RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1);
   7.233 -			req.AddUnitTypeRequirement(unitType2, unitType3);
   7.234 -			Unit unit = CreateUnitOfType(unitType1, army);
   7.235 -			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Passed));
   7.236 -			Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.Empty);
   7.237 -		}
   7.238 -
   7.239 -		[Test()]
   7.240 -		public void TestAddingTwoUnitsWithTwoUnitTypeComboRequiredAndOneUnitOfBothTypesPasses()
   7.241 -		{
   7.242 -			Army army = new Army(mockRace, "Test", 1000);
   7.243 -			AddUnitOfTypeToArmy(unitType3, army);
   7.244 -			AddUnitOfTypeToArmy(unitType2, army);
   7.245 -			AddUnitOfTypeToArmy(unitType1, army);
   7.246 -			RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1);
   7.247 -			req.AddUnitTypeRequirement(unitType2, unitType3);
   7.248 -			Unit unit = CreateUnitOfType(unitType1, army);
   7.249 -			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Passed));
   7.250 -			Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.Empty);
   7.251 -		}
   7.252 -
   7.253 -		[Test()]
   7.254 -		public void TestAddingTwoUnitsWithTwoUnitTypeComboRequiredAndTwoUnitsOfOneTypePasses()
   7.255 -		{
   7.256 -			Army army = new Army(mockRace, "Test", 1000);
   7.257 -			AddUnitOfTypeToArmy(unitType3, army);
   7.258 -			AddUnitOfTypeToArmy(unitType3, army);
   7.259 -			AddUnitOfTypeToArmy(unitType1, army);
   7.260 -			RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1);
   7.261 -			req.AddUnitTypeRequirement(unitType2, unitType3);
   7.262 -			Unit unit = CreateUnitOfType(unitType1, army);
   7.263 -			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Passed));
   7.264 -			Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.Empty);
   7.265 -		}
   7.266 -
   7.267 -		[Test()]
   7.268 -		public void TestAddingTwoUnitsWithTwoUnitTypeComboRequiredAndTwoUnitsOfOtherTypePasses()
   7.269 -		{
   7.270 -			Army army = new Army(mockRace, "Test", 1000);
   7.271 -			AddUnitOfTypeToArmy(unitType2, army);
   7.272 -			AddUnitOfTypeToArmy(unitType2, army);
   7.273 -			AddUnitOfTypeToArmy(unitType1, army);
   7.274 -			RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1);
   7.275 -			req.AddUnitTypeRequirement(unitType2, unitType3);
   7.276 -			Unit unit = CreateUnitOfType(unitType1, army);
   7.277 -			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Passed));
   7.278 -			Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.Empty);
   7.279 -		}
   7.280 -
   7.281 -		[Test()]
   7.282 -		public void TestAddingThreeUnitsWithTwoUnitTypeComboRequiredAndOneUnitOfBothTypesFails()
   7.283 -		{
   7.284 -			Army army = new Army(mockRace, "Test", 1000);
   7.285 -			AddUnitOfTypeToArmy(unitType3, army);
   7.286 -			AddUnitOfTypeToArmy(unitType2, army);
   7.287 -			AddUnitOfTypeToArmy(unitType1, army);
   7.288 -			AddUnitOfTypeToArmy(unitType1, army);
   7.289 -			RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1);
   7.290 -			req.AddUnitTypeRequirement(unitType2, unitType3);
   7.291 -			Unit unit = CreateUnitOfType(unitType1, army);
   7.292 -			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed));
   7.293 -			Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " or " + unitType3.Name + " for every 1 × " + unitType1.Name + " (would have 2 for 3)."));
   7.294 -		}
   7.295 -
   7.296 -		[Test()]
   7.297 -		public void TestAddingThreeUnitsWithTwoUnitTypeComboRequiredAndTwoUnitsOfOneTypeFails()
   7.298 -		{
   7.299 -			Army army = new Army(mockRace, "Test", 1000);
   7.300 -			AddUnitOfTypeToArmy(unitType3, army);
   7.301 -			AddUnitOfTypeToArmy(unitType3, army);
   7.302 -			AddUnitOfTypeToArmy(unitType1, army);
   7.303 -			AddUnitOfTypeToArmy(unitType1, army);
   7.304 -			RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1);
   7.305 -			req.AddUnitTypeRequirement(unitType2, unitType3);
   7.306 -			Unit unit = CreateUnitOfType(unitType1, army);
   7.307 -			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed));
   7.308 -			Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " or " + unitType3.Name + " for every 1 × " + unitType1.Name + " (would have 2 for 3)."));
   7.309 -		}
   7.310 -
   7.311 -		[Test()]
   7.312 -		public void TestAddingThreeUnitsWithTwoUnitTypeComboRequiredAndTwoUnitsOfOtherTypeFails()
   7.313 -		{
   7.314 -			Army army = new Army(mockRace, "Test", 1000);
   7.315 -			AddUnitOfTypeToArmy(unitType2, army);
   7.316 -			AddUnitOfTypeToArmy(unitType2, army);
   7.317 -			AddUnitOfTypeToArmy(unitType1, army);
   7.318 -			AddUnitOfTypeToArmy(unitType1, army);
   7.319 -			RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1);
   7.320 -			req.AddUnitTypeRequirement(unitType2, unitType3);
   7.321 -			Unit unit = CreateUnitOfType(unitType1, army);
   7.322 -			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed));
   7.323 -			Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " or " + unitType3.Name + " for every 1 × " + unitType1.Name + " (would have 2 for 3)."));
   7.324 -		}
   7.325 -
   7.326 -		[Test()]
   7.327 -		public void TestAddingUnrelatedUnitWithNoUnitsAndThreeForEachTwoCombinedUnitTypesRequiredIsNA()
   7.328 -		{
   7.329 -			Army army = new Army(mockRace, "Test", 1000);
   7.330 -			RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1);
   7.331 -			req.AddUnitTypeRequirement(3, unitType2, unitType3);
   7.332 -			Unit unit = CreateUnitOfType(unitType4, army);
   7.333 -			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.NotApplicable));
   7.334 -			Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.Empty);
   7.335 -		}
   7.336 -
   7.337 -		[Test()]
   7.338 -		public void TestAddingThirdUnitWithThreeForEachTwoUnitTypeComboRequiredAndUnitOfOneTypePasses()
   7.339 -		{
   7.340 -			Army army = new Army(mockRace, "Test", 1000);
   7.341 -			AddUnitOfTypeToArmy(unitType2, army);
   7.342 -			AddUnitsOfTypeToArmy(2, unitType1, army);
   7.343 -			RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1);
   7.344 -			req.AddUnitTypeRequirement(3, unitType2, unitType3);
   7.345 -			Unit unit = CreateUnitOfType(unitType1, army);
   7.346 -			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Passed));
   7.347 -			Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.Empty);
   7.348 -		}
   7.349 -
   7.350 -		[Test()]
   7.351 -		public void TestAddingThirdUnitWithThreeForEachTwoUnitTypeComboRequiredAndUnitOfOtherTypePasses()
   7.352 -		{
   7.353 -			Army army = new Army(mockRace, "Test", 1000);
   7.354 -			AddUnitOfTypeToArmy(unitType3, army);
   7.355 -			AddUnitsOfTypeToArmy(2, unitType1, army);
   7.356 -			RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1);
   7.357 -			req.AddUnitTypeRequirement(3, unitType2, unitType3);
   7.358 -			Unit unit = CreateUnitOfType(unitType1, army);
   7.359 -			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Passed));
   7.360 -			Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.Empty);
   7.361 -		}
   7.362 -
   7.363 -		[Test()]
   7.364 -		public void TestAddingSixthUnitWithThreeForEachTwoUnitTypeComboRequiredAndOneUnitOfBothTypesPasses()
   7.365 -		{
   7.366 -			Army army = new Army(mockRace, "Test", 1000);
   7.367 -			AddUnitOfTypeToArmy(unitType3, army);
   7.368 -			AddUnitOfTypeToArmy(unitType2, army);
   7.369 -			AddUnitsOfTypeToArmy(5, unitType1, army);
   7.370 -			RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1);
   7.371 -			req.AddUnitTypeRequirement(3, unitType2, unitType3);
   7.372 -			Unit unit = CreateUnitOfType(unitType1, army);
   7.373 -			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Passed));
   7.374 -			Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.Empty);
   7.375 -		}
   7.376 -
   7.377 -		[Test()]
   7.378 -		public void TestAddingSixthUnitWithThreeForEachTwoUnitTypeComboRequiredAndTwoUnitsOfOneTypePasses()
   7.379 -		{
   7.380 -			Army army = new Army(mockRace, "Test", 1000);
   7.381 -			AddUnitsOfTypeToArmy(2, unitType3, army);
   7.382 -			AddUnitsOfTypeToArmy(5, unitType1, army);
   7.383 -			RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1);
   7.384 -			req.AddUnitTypeRequirement(3, unitType2, unitType3);
   7.385 -			Unit unit = CreateUnitOfType(unitType1, army);
   7.386 -			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Passed));
   7.387 -			Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.Empty);
   7.388 -		}
   7.389 -
   7.390 -		[Test()]
   7.391 -		public void TestAddingSixthUnitWithThreeForEachTwoUnitTypeComboRequiredAndTwoUnitsOfOtherTypePasses()
   7.392 -		{
   7.393 -			Army army = new Army(mockRace, "Test", 1000);
   7.394 -			AddUnitsOfTypeToArmy(2, unitType2, army);
   7.395 -			AddUnitsOfTypeToArmy(5, unitType1, army);
   7.396 -			RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1);
   7.397 -			req.AddUnitTypeRequirement(3, unitType2, unitType3);
   7.398 -			Unit unit = CreateUnitOfType(unitType1, army);
   7.399 -			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Passed));
   7.400 -			Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.Empty);
   7.401 -		}
   7.402 -
   7.403 -		[Test()]
   7.404 -		public void TestAddingSevenUnitsWithThreeForEachTwoUnitTypeComboRequiredAndOneUnitOfBothTypesFails()
   7.405 -		{
   7.406 -			Army army = new Army(mockRace, "Test", 1000);
   7.407 -			AddUnitOfTypeToArmy(unitType3, army);
   7.408 -			AddUnitOfTypeToArmy(unitType2, army);
   7.409 -			AddUnitsOfTypeToArmy(6, unitType1, army);
   7.410 -			RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1);
   7.411 -			req.AddUnitTypeRequirement(3, unitType2, unitType3);
   7.412 -			Unit unit = CreateUnitOfType(unitType1, army);
   7.413 -			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed));
   7.414 -			Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " or " + unitType3.Name + " for every 3 × " + unitType1.Name + " (would have 2 for 7)."));
   7.415 -		}
   7.416 -
   7.417 -		[Test()]
   7.418 -		public void TestAddingSevenUnitsWithThreeForEachTwoUnitTypeComboRequiredAndTwoUnitsOfOneTypeFails()
   7.419 -		{
   7.420 -			Army army = new Army(mockRace, "Test", 1000);
   7.421 -			AddUnitsOfTypeToArmy(2, unitType3, army);
   7.422 -			AddUnitsOfTypeToArmy(6, unitType1, army);
   7.423 -			RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1);
   7.424 -			req.AddUnitTypeRequirement(3, unitType2, unitType3);
   7.425 -			Unit unit = CreateUnitOfType(unitType1, army);
   7.426 -			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed));
   7.427 -			Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " or " + unitType3.Name + " for every 3 × " + unitType1.Name + " (would have 2 for 7)."));
   7.428 -		}
   7.429 -
   7.430 -		[Test()]
   7.431 -		public void TestAddingSevenUnitsWithThreeForEachTwoUnitTypeComboRequiredAndTwoUnitsOfOtherTypeFails()
   7.432 -		{
   7.433 -			Army army = new Army(mockRace, "Test", 1000);
   7.434 -			AddUnitsOfTypeToArmy(2, unitType2, army);
   7.435 -			AddUnitsOfTypeToArmy(6, unitType1, army);
   7.436 -			RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1);
   7.437 -			req.AddUnitTypeRequirement(3, unitType2, unitType3);
   7.438 -			Unit unit = CreateUnitOfType(unitType1, army);
   7.439 -			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed));
   7.440 -			Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " or " + unitType3.Name + " for every 3 × " + unitType1.Name + " (would have 2 for 7)."));
   7.441 -		}
   7.442 -
   7.443 -		[Test()]
   7.444 -		public void TestValidatingArmyWithNoUnitsAndOneUnitTypeRequiredIsNA()
   7.445 -		{
   7.446 -			Army army = new Army(mockRace, "Test", 1000);
   7.447 -			RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1, unitType2);
   7.448 -			Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.NotApplicable));
   7.449 -			Assert.That(req.GetValidationMessage(army), Is.Empty);
   7.450 -		}
   7.451 -
   7.452 -		[Test()]
   7.453 -		public void TestValidatingArmyWithOneUnitTypeRequiredAndOneUnitOfTypePasses()
   7.454 -		{
   7.455 -			Army army = new Army(mockRace, "Test", 1000);
   7.456 -			AddUnitOfTypeToArmy(unitType2, army);
   7.457 -			AddUnitOfTypeToArmy(unitType1, army);
   7.458 -			RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1, unitType2);
   7.459 -			Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Passed));
   7.460 -			Assert.That(req.GetValidationMessage(army), Is.Empty);
   7.461 -		}
   7.462 -
   7.463 -		[Test()]
   7.464 -		public void TestValidatingArmyWithOneUnitTypeRequiredAndNoUnitOfTypeFails()
   7.465 -		{
   7.466 -			Army army = new Army(mockRace, "Test", 1000);
   7.467 -			AddUnitOfTypeToArmy(unitType1, army);
   7.468 -			RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1, unitType2);
   7.469 -			Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Failed));
   7.470 -			Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " for every 1 × " + unitType1.Name + " (have 0 for 1)."));
   7.471 -		}
   7.472 -
   7.473 -		[Test()]
   7.474 -		public void TestValidatingArmyWithTwoDifferentUnitTypesRequiredAndNoUnitOfOneTypeFails()
   7.475 -		{
   7.476 -			Army army = new Army(mockRace, "Test", 1000);
   7.477 -			AddUnitOfTypeToArmy(unitType2, army);
   7.478 -			AddUnitOfTypeToArmy(unitType1, army);
   7.479 -			RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1);
   7.480 -			req.AddUnitTypeRequirement(unitType2);
   7.481 -			req.AddUnitTypeRequirement(unitType3);
   7.482 -			Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Failed));
   7.483 -			Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 1 × " + unitType3.Name + " for every 1 × " + unitType1.Name + " (have 0 for 1)."));
   7.484 -		}
   7.485 -
   7.486 -		[Test()]
   7.487 -		public void TestValidatingArmyWithTwoUnitsAndOneUnitTypeRequiredAndOneUnitOfTypeFails()
   7.488 -		{
   7.489 -			Army army = new Army(mockRace, "Test", 1000);
   7.490 -			AddUnitOfTypeToArmy(unitType2, army);
   7.491 -			AddUnitOfTypeToArmy(unitType1, army);
   7.492 -			AddUnitOfTypeToArmy(unitType1, army);
   7.493 -			RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1, unitType2);
   7.494 -			Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Failed));
   7.495 -			Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " for every 1 × " + unitType1.Name + " (have 1 for 2)."));
   7.496 -		}
   7.497 -
   7.498 -		[Test()]
   7.499 -		public void TestValidatingArmyWithTwoUnitsAndTwoOfUnitTypeAllowedForOneUnitTypeRequiredAndOneUnitOfTypePasses()
   7.500 -		{
   7.501 -			Army army = new Army(mockRace, "Test", 1000);
   7.502 -			AddUnitOfTypeToArmy(unitType2, army);
   7.503 -			AddUnitOfTypeToArmy(unitType1, army);
   7.504 -			AddUnitOfTypeToArmy(unitType1, army);
   7.505 -			RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1);
   7.506 -			req.AddUnitTypeRequirement(unitType2, 1, 2);
   7.507 -			Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Passed));
   7.508 -			Assert.That(req.GetValidationMessage(army), Is.Empty);
   7.509 -		}
   7.510 -
   7.511 -		[Test()]
   7.512 -		public void TestValidatingArmyWithTwoUnitsWithTwoAllowedAndOneAllowedForDifferentTypesFails()
   7.513 -		{
   7.514 -			Army army = new Army(mockRace, "Test", 1000);
   7.515 -			AddUnitOfTypeToArmy(unitType2, army);
   7.516 -			AddUnitOfTypeToArmy(unitType3, army);
   7.517 -			AddUnitOfTypeToArmy(unitType1, army);
   7.518 -			AddUnitOfTypeToArmy(unitType1, army);
   7.519 -			RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1);
   7.520 -			req.AddUnitTypeRequirement(unitType2, 1, 2);
   7.521 -			req.AddUnitTypeRequirement(unitType3, 1, 1);
   7.522 -			Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Failed));
   7.523 -			Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 1 × " + unitType3.Name + " for every 1 × " + unitType1.Name + " (have 1 for 2)."));
   7.524 -		}
   7.525 -
   7.526 -		[Test()]
   7.527 -		public void TestValidatingArmyWithTwoUnitsWithOneAllowedForTwoTypesFails()
   7.528 -		{
   7.529 -			Army army = new Army(mockRace, "Test", 1000);
   7.530 -			AddUnitOfTypeToArmy(unitType2, army);
   7.531 -			AddUnitOfTypeToArmy(unitType3, army);
   7.532 -			AddUnitOfTypeToArmy(unitType1, army);
   7.533 -			AddUnitOfTypeToArmy(unitType1, army);
   7.534 -			RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1);
   7.535 -			req.AddUnitTypeRequirement(unitType2, 1, 1);
   7.536 -			req.AddUnitTypeRequirement(unitType3, 1, 1);
   7.537 -			Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Failed));
   7.538 -			Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " for every 1 × " + unitType1.Name + " (have 1 for 2); 1 × " + unitType3.Name + " for every 1 × " + unitType1.Name + " (have 1 for 2)."));
   7.539 -		}
   7.540 -
   7.541 -		[Test()]
   7.542 -		public void TestValidatingArmyWithTwoUnitsWithOneAllowedForTwoTypesFails_ShorthandMethod()
   7.543 -		{
   7.544 -			Army army = new Army(mockRace, "Test", 1000);
   7.545 -			AddUnitOfTypeToArmy(unitType2, army);
   7.546 -			AddUnitOfTypeToArmy(unitType3, army);
   7.547 -			AddUnitOfTypeToArmy(unitType1, army);
   7.548 -			AddUnitOfTypeToArmy(unitType1, army);
   7.549 -			RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1, unitType2, unitType3);
   7.550 -			Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Failed));
   7.551 -			Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " for every 1 × " + unitType1.Name + " (have 1 for 2); 1 × " + unitType3.Name + " for every 1 × " + unitType1.Name + " (have 1 for 2)."));
   7.552 -		}
   7.553 -
   7.554 -		[Test()]
   7.555 -		public void TestValidatingArmyWithOneUnitWithThreeOfUnitTypeAllowedForTwoOfUnitTypeRequiredAndOneUnitOfTypeFails()
   7.556 -		{
   7.557 -			Army army = new Army(mockRace, "Test", 1000);
   7.558 -			AddUnitOfTypeToArmy(unitType2, army);
   7.559 -			AddUnitOfTypeToArmy(unitType1, army);
   7.560 -			RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1);
   7.561 -			req.AddUnitTypeRequirement(unitType2, 2, 3);
   7.562 -			Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Failed));
   7.563 -			Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 2 × " + unitType2.Name + " for every 3 × " + unitType1.Name + " (have 1 for 1)."));
   7.564 -		}
   7.565 -
   7.566 -		[Test()]
   7.567 -		public void TestValidatingArmyWithTwoUnitsWithThreeOfUnitTypeAllowedForTwoOfUnitTypeRequiredAndOneUnitOfTypeFails()
   7.568 -		{
   7.569 -			Army army = new Army(mockRace, "Test", 1000);
   7.570 -			AddUnitOfTypeToArmy(unitType2, army);
   7.571 -			AddUnitsOfTypeToArmy(2, unitType1, army);
   7.572 -			RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1);
   7.573 -			req.AddUnitTypeRequirement(unitType2, 2, 3);
   7.574 -			Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Failed));
   7.575 -			Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 2 × " + unitType2.Name + " for every 3 × " + unitType1.Name + " (have 1 for 2)."));
   7.576 -		}
   7.577 -
   7.578 -		[Test()]
   7.579 -		public void TestValidatingArmyWithFourUnitsWithThreeOfUnitTypeAllowedForTwoOfUnitTypeRequiredAndThreeUnitsOfTypeFails()
   7.580 -		{
   7.581 -			Army army = new Army(mockRace, "Test", 1000);
   7.582 -			AddUnitsOfTypeToArmy(3, unitType2, army);
   7.583 -			AddUnitsOfTypeToArmy(4, unitType1, army);
   7.584 -			RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1);
   7.585 -			req.AddUnitTypeRequirement(unitType2, 2, 3);
   7.586 -			Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Failed));
   7.587 -			Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 2 × " + unitType2.Name + " for every 3 × " + unitType1.Name + " (have 3 for 4)."));
   7.588 -		}
   7.589 -
   7.590 -		[Test()]
   7.591 -		public void TestValidatingArmyWithThreeUnitsAndTwoOfUnitTypeAllowedForOneUnitTypeRequiredAndOneUnitOfTypeFails()
   7.592 -		{
   7.593 -			Army army = new Army(mockRace, "Test", 1000);
   7.594 -			AddUnitOfTypeToArmy(unitType2, army);
   7.595 -			AddUnitOfTypeToArmy(unitType1, army);
   7.596 -			AddUnitOfTypeToArmy(unitType1, army);
   7.597 -			AddUnitOfTypeToArmy(unitType1, army);
   7.598 -			RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1);
   7.599 -			req.AddUnitTypeRequirement(unitType2, 1, 2);
   7.600 -			Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Failed));
   7.601 -			Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " for every 2 × " + unitType1.Name + " (have 1 for 3)."));
   7.602 -		}
   7.603 -
   7.604 -		[Test()]
   7.605 -		public void TestValidatingArmyWithNoUnitsAndThreeForEachTwoCombinedUnitTypesRequiredIsNA()
   7.606 -		{
   7.607 -			Army army = new Army(mockRace, "Test", 1000);
   7.608 -			AddUnitOfTypeToArmy(unitType4, army);
   7.609 -			RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1);
   7.610 -			req.AddUnitTypeRequirement(3, unitType2, unitType3);
   7.611 -			Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.NotApplicable));
   7.612 -			Assert.That(req.GetValidationMessage(army), Is.Empty);
   7.613 -		}
   7.614 -
   7.615 -		[Test()]
   7.616 -		public void TestValidatingArmyWithThreeUnitsWithThreeForEachTwoUnitTypeComboRequiredAndUnitOfOneTypePasses()
   7.617 -		{
   7.618 -			Army army = new Army(mockRace, "Test", 1000);
   7.619 -			AddUnitOfTypeToArmy(unitType2, army);
   7.620 -			AddUnitsOfTypeToArmy(3, unitType1, army);
   7.621 -			RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1);
   7.622 -			req.AddUnitTypeRequirement(3, unitType2, unitType3);
   7.623 -			Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Passed));
   7.624 -			Assert.That(req.GetValidationMessage(army), Is.Empty);
   7.625 -		}
   7.626 -
   7.627 -		[Test()]
   7.628 -		public void TestValidatingArmyWithThreeUnitsWithThreeForEachTwoUnitTypeComboRequiredAndUnitOfOtherTypePasses()
   7.629 -		{
   7.630 -			Army army = new Army(mockRace, "Test", 1000);
   7.631 -			AddUnitOfTypeToArmy(unitType3, army);
   7.632 -			AddUnitsOfTypeToArmy(3, unitType1, army);
   7.633 -			RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1);
   7.634 -			req.AddUnitTypeRequirement(3, unitType2, unitType3);
   7.635 -			Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Passed));
   7.636 -			Assert.That(req.GetValidationMessage(army), Is.Empty);
   7.637 -		}
   7.638 -
   7.639 -		[Test()]
   7.640 -		public void TestValidatingArmyWithSixUnitsWithThreeForEachTwoUnitTypeComboRequiredAndOneUnitOfBothTypesPasses()
   7.641 -		{
   7.642 -			Army army = new Army(mockRace, "Test", 1000);
   7.643 -			AddUnitOfTypeToArmy(unitType3, army);
   7.644 -			AddUnitOfTypeToArmy(unitType2, army);
   7.645 -			AddUnitsOfTypeToArmy(6, unitType1, army);
   7.646 -			RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1);
   7.647 -			req.AddUnitTypeRequirement(3, unitType2, unitType3);
   7.648 -			Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Passed));
   7.649 -			Assert.That(req.GetValidationMessage(army), Is.Empty);
   7.650 -		}
   7.651 -
   7.652 -		[Test()]
   7.653 -		public void TestValidatingArmyWithSixUnitsWithThreeForEachTwoUnitTypeComboRequiredAndTwoUnitsOfOneTypePasses()
   7.654 -		{
   7.655 -			Army army = new Army(mockRace, "Test", 1000);
   7.656 -			AddUnitsOfTypeToArmy(2, unitType3, army);
   7.657 -			AddUnitsOfTypeToArmy(6, unitType1, army);
   7.658 -			RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1);
   7.659 -			req.AddUnitTypeRequirement(3, unitType2, unitType3);
   7.660 -			Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Passed));
   7.661 -			Assert.That(req.GetValidationMessage(army), Is.Empty);
   7.662 -		}
   7.663 -
   7.664 -		[Test()]
   7.665 -		public void TestValidatingArmyWithSixUnitsWithThreeForEachTwoUnitTypeComboRequiredAndTwoUnitsOfOtherTypePasses()
   7.666 -		{
   7.667 -			Army army = new Army(mockRace, "Test", 1000);
   7.668 -			AddUnitsOfTypeToArmy(2, unitType2, army);
   7.669 -			AddUnitsOfTypeToArmy(6, unitType1, army);
   7.670 -			RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1);
   7.671 -			req.AddUnitTypeRequirement(3, unitType2, unitType3);
   7.672 -			Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Passed));
   7.673 -			Assert.That(req.GetValidationMessage(army), Is.Empty);
   7.674 -		}
   7.675 -
   7.676 -		[Test()]
   7.677 -		public void TestValidatingArmyWithSevenUnitsWithThreeForEachTwoUnitTypeComboRequiredAndOneUnitOfBothTypesFails()
   7.678 -		{
   7.679 -			Army army = new Army(mockRace, "Test", 1000);
   7.680 -			AddUnitOfTypeToArmy(unitType3, army);
   7.681 -			AddUnitOfTypeToArmy(unitType2, army);
   7.682 -			AddUnitsOfTypeToArmy(7, unitType1, army);
   7.683 -			RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1);
   7.684 -			req.AddUnitTypeRequirement(3, unitType2, unitType3);
   7.685 -			Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Failed));
   7.686 -			Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " or " + unitType3.Name + " for every 3 × " + unitType1.Name + " (have 2 for 7)."));
   7.687 -		}
   7.688 -
   7.689 -		[Test()]
   7.690 -		public void TestValidatingArmyWithSevenUnitsWithThreeForEachTwoUnitTypeComboRequiredAndTwoUnitsOfOneTypeFails()
   7.691 -		{
   7.692 -			Army army = new Army(mockRace, "Test", 1000);
   7.693 -			AddUnitsOfTypeToArmy(2, unitType3, army);
   7.694 -			AddUnitsOfTypeToArmy(7, unitType1, army);
   7.695 -			RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1);
   7.696 -			req.AddUnitTypeRequirement(3, unitType2, unitType3);
   7.697 -			Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Failed));
   7.698 -			Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " or " + unitType3.Name + " for every 3 × " + unitType1.Name + " (have 2 for 7)."));
   7.699 -		}
   7.700 -
   7.701 -		[Test()]
   7.702 -		public void TestValidatingArmyWithSevenUnitsWithThreeForEachTwoUnitTypeComboRequiredAndTwoUnitsOfOtherTypeFails()
   7.703 -		{
   7.704 -			Army army = new Army(mockRace, "Test", 1000);
   7.705 -			AddUnitsOfTypeToArmy(2, unitType2, army);
   7.706 -			AddUnitsOfTypeToArmy(7, unitType1, army);
   7.707 -			RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1);
   7.708 -			req.AddUnitTypeRequirement(3, unitType2, unitType3);
   7.709 -			Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Failed));
   7.710 -			Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " or " + unitType3.Name + " for every 3 × " + unitType1.Name + " (have 2 for 7)."));
   7.711 -		}
   7.712 -
   7.713 -		private static void AddUnitsOfTypeToArmy(int count, UnitType unitType, Army army)
   7.714 -		{
   7.715 -			for (int i = 0; i < count; i++)
   7.716 -			{
   7.717 -				AddUnitOfTypeToArmy(unitType, army);
   7.718 -			}
   7.719 -		}
   7.720 -
   7.721 -		private static void AddUnitOfTypeToArmy(UnitType unitType, Army army)
   7.722 -		{
   7.723 -			army.AddUnit(CreateUnitOfType(unitType, army));
   7.724 -		}
   7.725 -
   7.726 -		private static Unit CreateUnitOfType(UnitType unitType, Army army)
   7.727 -		{
   7.728 -			return new Unit(unitType, army.GetCategory(unitType.MainCategory));
   7.729 -		}
   7.730 -
   7.731 -		public override RequiresNUnitsForMUnitsRequirement GetObject()
   7.732 -		{
   7.733 -			RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType3);
   7.734 -			req.AddUnitTypeRequirement(unitType1, 2, 3);
   7.735 -			return req;
   7.736 -		}
   7.737 -
   7.738 -		public override RequiresNUnitsForMUnitsRequirement GetSameObject()
   7.739 -		{
   7.740 -			RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType3);
   7.741 -			req.AddUnitTypeRequirement(unitType1, 2, 3);
   7.742 -			return req;
   7.743 -		}
   7.744 -
   7.745 -		public override RequiresNUnitsForMUnitsRequirement GetDifferentObject()
   7.746 -		{
   7.747 -			RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType3);
   7.748 -			DummyWarFoundryFactory factory = new DummyWarFoundryFactory();
   7.749 -			GameSystem gameSystem = new GameSystem("system", "system", factory);
   7.750 -			Race race = new Race("race", "race", gameSystem, factory);
   7.751 -			req.AddUnitTypeRequirement(new UnitType("id2", "Type 2", race), 2, 3);
   7.752 -			return req;
   7.753 -		}
   7.754 -	}
   7.755 -}
   7.756 -
     8.1 --- a/API/Objects/Requirement/RequiresNoMoreThanNOfUnitTypeRequirementTest.cs	Tue Jan 31 20:59:15 2012 +0000
     8.2 +++ b/API/Objects/Requirement/RequiresNoMoreThanNOfUnitTypeRequirementTest.cs	Wed Feb 22 20:48:40 2012 +0000
     8.3 @@ -11,10 +11,10 @@
     8.4  
     8.5  namespace IBBoard.WarFoundry.API.Objects.Requirement
     8.6  {
     8.7 -	[TestFixture()]
     8.8 -	public class RequiresNoMoreThanNOfUnitTypeRequirementTest : AbstractEqualityTest<RequiresNoMoreThanNOfUnitTypeRequirement>
     8.9 +	public abstract class RequiresNoMoreThanNOfUnitTypeRequirementTest : AbstractEqualityTest<RequiresNoMoreThanNOfUnitTypeRequirement<UnitType>>
    8.10  	{
    8.11  		private MockRace mockRace;
    8.12 +		private UnitType allowedUnitType;
    8.13  		private UnitType unitType1;
    8.14  		private UnitType unitType2;
    8.15  		private UnitType unitType3;
    8.16 @@ -23,6 +23,8 @@
    8.17  		public void SetupRace()
    8.18  		{
    8.19  			mockRace = new MockRace();
    8.20 +			allowedUnitType = new MockUnitType("allowed", "Allowed Type");
    8.21 +			mockRace.AddUnitType(allowedUnitType);
    8.22  			unitType1 = new MockUnitType("type1", "Unit Type 1");
    8.23  			mockRace.AddUnitType(unitType1);
    8.24  			unitType2 = new MockUnitType("type2", "Unit Type 2");
    8.25 @@ -36,7 +38,7 @@
    8.26  		{
    8.27  			Army army = new Army(mockRace, "Test", 1000);
    8.28  			Unit unit = CreateUnitOfType(unitType1, army);
    8.29 -			RequiresNoMoreThanNOfUnitTypeRequirement req = new RequiresNoMoreThanNOfUnitTypeRequirement(unitType2);
    8.30 +			RequiresNoMoreThanNOfUnitTypeRequirement<UnitType> req = new RequiresNoMoreThanNOfUnitTypeRequirement<UnitType>(allowedUnitType, unitType2);
    8.31  			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Passed));
    8.32  		}
    8.33  
    8.34 @@ -46,7 +48,7 @@
    8.35  			Army army = new Army(mockRace, "Test", 1000);
    8.36  			AddUnitOfTypeToArmy(unitType2, army);
    8.37  			Unit unit = CreateUnitOfType(unitType1, army);
    8.38 -			RequiresNoMoreThanNOfUnitTypeRequirement req = new RequiresNoMoreThanNOfUnitTypeRequirement(unitType2);
    8.39 +			RequiresNoMoreThanNOfUnitTypeRequirement<UnitType> req = new RequiresNoMoreThanNOfUnitTypeRequirement<UnitType>(allowedUnitType, unitType2);
    8.40  			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed));
    8.41  		}
    8.42  
    8.43 @@ -54,7 +56,7 @@
    8.44  		public void TestAddingUnitTypeWithNoUnitsAndOneUnitTypeRequiredIsAllowed()
    8.45  		{
    8.46  			Army army = new Army(mockRace, "Test", 1000);
    8.47 -			RequiresNoMoreThanNOfUnitTypeRequirement req = new RequiresNoMoreThanNOfUnitTypeRequirement(unitType2);
    8.48 +			RequiresNoMoreThanNOfUnitTypeRequirement<UnitType> req = new RequiresNoMoreThanNOfUnitTypeRequirement<UnitType>(allowedUnitType, unitType2);
    8.49  			Assert.That(req.AllowsAdding(unitType1, army), Is.EqualTo(Validation.Passed));
    8.50  		}
    8.51  
    8.52 @@ -63,7 +65,7 @@
    8.53  		{
    8.54  			Army army = new Army(mockRace, "Test", 1000);
    8.55  			AddUnitOfTypeToArmy(unitType2, army);
    8.56 -			RequiresNoMoreThanNOfUnitTypeRequirement req = new RequiresNoMoreThanNOfUnitTypeRequirement(unitType2);
    8.57 +			RequiresNoMoreThanNOfUnitTypeRequirement<UnitType> req = new RequiresNoMoreThanNOfUnitTypeRequirement<UnitType>(allowedUnitType, unitType2);
    8.58  			Assert.That(req.AllowsAdding(unitType1, army), Is.EqualTo(Validation.Failed));
    8.59  		}
    8.60  
    8.61 @@ -72,7 +74,7 @@
    8.62  		{
    8.63  			Army army = new Army(mockRace, "Test", 1000);
    8.64  			AddUnitOfTypeToArmy(unitType2, army);
    8.65 -			RequiresNoMoreThanNOfUnitTypeRequirement req = new RequiresNoMoreThanNOfUnitTypeRequirement();
    8.66 +			RequiresNoMoreThanNOfUnitTypeRequirement<UnitType> req = new RequiresNoMoreThanNOfUnitTypeRequirement<UnitType>(allowedUnitType);
    8.67  			req.AddUnitTypeRequirement(unitType2, 1);
    8.68  			Assert.That(req.AllowsAdding(unitType1, army), Is.EqualTo(Validation.Passed));
    8.69  		}
    8.70 @@ -83,7 +85,7 @@
    8.71  			Army army = new Army(mockRace, "Test", 1000);
    8.72  			AddUnitOfTypeToArmy(unitType2, army);
    8.73  			AddUnitOfTypeToArmy(unitType2, army);
    8.74 -			RequiresNoMoreThanNOfUnitTypeRequirement req = new RequiresNoMoreThanNOfUnitTypeRequirement();
    8.75 +			RequiresNoMoreThanNOfUnitTypeRequirement<UnitType> req = new RequiresNoMoreThanNOfUnitTypeRequirement<UnitType>(allowedUnitType);
    8.76  			req.AddUnitTypeRequirement(unitType2, 1);
    8.77  			Assert.That(req.AllowsAdding(unitType1, army), Is.EqualTo(Validation.Failed));
    8.78  		}
    8.79 @@ -92,7 +94,7 @@
    8.80  		public void TestAddingUnitTypeDefaultsToNoMoreThanZero()
    8.81  		{
    8.82  			Army army = new Army(mockRace, "Test", 1000);
    8.83 -			RequiresNoMoreThanNOfUnitTypeRequirement req = new RequiresNoMoreThanNOfUnitTypeRequirement();
    8.84 +			RequiresNoMoreThanNOfUnitTypeRequirement<UnitType> req = new RequiresNoMoreThanNOfUnitTypeRequirement<UnitType>(allowedUnitType);
    8.85  			req.AddUnitTypeRequirement(unitType2);
    8.86  			Assert.That(req.AllowsAdding(unitType1, army), Is.EqualTo(Validation.Passed));
    8.87  			AddUnitOfTypeToArmy(unitType2, army);
    8.88 @@ -103,7 +105,7 @@
    8.89  		public void TestRequirementBecomesInvalidWhenProhibitedUnitsChange()
    8.90  		{
    8.91  			Army army = new Army(mockRace, "Test", 1000);
    8.92 -			RequiresNoMoreThanNOfUnitTypeRequirement req = new RequiresNoMoreThanNOfUnitTypeRequirement();
    8.93 +			RequiresNoMoreThanNOfUnitTypeRequirement<UnitType> req = new RequiresNoMoreThanNOfUnitTypeRequirement<UnitType>(allowedUnitType);
    8.94  			req.AddUnitTypeRequirement(unitType2);
    8.95  			Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Passed));
    8.96  			AddUnitOfTypeToArmy(unitType2, army);
    8.97 @@ -114,7 +116,7 @@
    8.98  		public void TestValidationMessageIsBlankForPass()
    8.99  		{
   8.100  			Army army = new Army(mockRace, "Test", 1000);
   8.101 -			RequiresNoMoreThanNOfUnitTypeRequirement req = new RequiresNoMoreThanNOfUnitTypeRequirement(unitType1);
   8.102 +			RequiresNoMoreThanNOfUnitTypeRequirement<UnitType> req = new RequiresNoMoreThanNOfUnitTypeRequirement<UnitType>(allowedUnitType, unitType1);
   8.103  			Assert.That(req.GetValidationMessage(army), Is.Empty);
   8.104  		}
   8.105  
   8.106 @@ -123,7 +125,7 @@
   8.107  		{
   8.108  			Army army = new Army(mockRace, "Test", 1000);
   8.109  			AddUnitOfTypeToArmy(unitType1, army);
   8.110 -			RequiresNoMoreThanNOfUnitTypeRequirement req = new RequiresNoMoreThanNOfUnitTypeRequirement(unitType1);
   8.111 +			RequiresNoMoreThanNOfUnitTypeRequirement<UnitType> req = new RequiresNoMoreThanNOfUnitTypeRequirement<UnitType>(allowedUnitType, unitType1);
   8.112  			Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army cannot contain more than: 0 × " + unitType1.Name + " (have 1)."));
   8.113  		}
   8.114  
   8.115 @@ -134,7 +136,7 @@
   8.116  			AddUnitOfTypeToArmy(unitType1, army);
   8.117  			AddUnitOfTypeToArmy(unitType1, army);
   8.118  			AddUnitOfTypeToArmy(unitType1, army);
   8.119 -			RequiresNoMoreThanNOfUnitTypeRequirement req = new RequiresNoMoreThanNOfUnitTypeRequirement();
   8.120 +			RequiresNoMoreThanNOfUnitTypeRequirement<UnitType> req = new RequiresNoMoreThanNOfUnitTypeRequirement<UnitType>(allowedUnitType);
   8.121  			req.AddUnitTypeRequirement(unitType1, 2);
   8.122  			Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army cannot contain more than: 2 × " + unitType1.Name + " (have 3)."));
   8.123  		}
   8.124 @@ -145,7 +147,7 @@
   8.125  			Army army = new Army(mockRace, "Test", 1000);
   8.126  			AddUnitOfTypeToArmy(unitType1, army);
   8.127  			AddUnitOfTypeToArmy(unitType2, army);
   8.128 -			RequiresNoMoreThanNOfUnitTypeRequirement req = new RequiresNoMoreThanNOfUnitTypeRequirement();
   8.129 +			RequiresNoMoreThanNOfUnitTypeRequirement<UnitType> req = new RequiresNoMoreThanNOfUnitTypeRequirement<UnitType>(allowedUnitType);
   8.130  			req.AddUnitTypeRequirement(unitType1);
   8.131  			req.AddUnitTypeRequirement(unitType2);
   8.132  			Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army cannot contain more than: 0 × " + unitType1.Name + " (have 1); 0 × " + unitType2.Name + " (have 1)."));
   8.133 @@ -156,7 +158,7 @@
   8.134  		{
   8.135  			Army army = new Army(mockRace, "Test", 1000);
   8.136  			AddUnitOfTypeToArmy(unitType1, army);
   8.137 -			RequiresNoMoreThanNOfUnitTypeRequirement req = new RequiresNoMoreThanNOfUnitTypeRequirement();
   8.138 +			RequiresNoMoreThanNOfUnitTypeRequirement<UnitType> req = new RequiresNoMoreThanNOfUnitTypeRequirement<UnitType>(allowedUnitType);
   8.139  			req.AddUnitTypeRequirement(unitType1);
   8.140  			req.AddUnitTypeRequirement(unitType2);
   8.141  			Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army cannot contain more than: 0 × " + unitType1.Name + " (have 1)."));
   8.142 @@ -167,7 +169,7 @@
   8.143  		{
   8.144  			Army army = new Army(mockRace, "Test", 1000);
   8.145  			AddUnitOfTypeToArmy(unitType2, army);
   8.146 -			RequiresNoMoreThanNOfUnitTypeRequirement req = new RequiresNoMoreThanNOfUnitTypeRequirement();
   8.147 +			RequiresNoMoreThanNOfUnitTypeRequirement<UnitType> req = new RequiresNoMoreThanNOfUnitTypeRequirement<UnitType>(allowedUnitType);
   8.148  			req.AddUnitTypeRequirement(unitType1);
   8.149  			req.AddUnitTypeRequirement(unitType2);
   8.150  			Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army cannot contain more than: 0 × " + unitType2.Name + " (have 1)."));
   8.151 @@ -177,7 +179,7 @@
   8.152  		public void TestAllowsAddMessageIsBlankForPass()
   8.153  		{
   8.154  			Army army = new Army(mockRace, "Test", 1000);
   8.155 -			RequiresNoMoreThanNOfUnitTypeRequirement req = new RequiresNoMoreThanNOfUnitTypeRequirement(unitType1);
   8.156 +			RequiresNoMoreThanNOfUnitTypeRequirement<UnitType> req = new RequiresNoMoreThanNOfUnitTypeRequirement<UnitType>(allowedUnitType, unitType1);
   8.157  			Assert.That(req.GetAllowsAddingMessage(unitType2, army), Is.Empty);
   8.158  		}
   8.159  
   8.160 @@ -185,7 +187,7 @@
   8.161  		public void TestAllowsAddMessageIsCorrectForFailWithOneUnitProhibited()
   8.162  		{
   8.163  			Army army = new Army(mockRace, "Test", 1000);
   8.164 -			RequiresNoMoreThanNOfUnitTypeRequirement req = new RequiresNoMoreThanNOfUnitTypeRequirement(unitType1);
   8.165 +			RequiresNoMoreThanNOfUnitTypeRequirement<UnitType> req = new RequiresNoMoreThanNOfUnitTypeRequirement<UnitType>(allowedUnitType, unitType1);
   8.166  			Assert.That(req.GetAllowsAddingMessage(unitType1, army), Is.EqualTo("Army cannot contain more than: 0 × " + unitType1.Name + " (would have 1)."));
   8.167  		}
   8.168  
   8.169 @@ -195,7 +197,7 @@
   8.170  			Army army = new Army(mockRace, "Test", 1000);
   8.171  			AddUnitOfTypeToArmy(unitType1, army);
   8.172  			AddUnitOfTypeToArmy(unitType1, army);
   8.173 -			RequiresNoMoreThanNOfUnitTypeRequirement req = new RequiresNoMoreThanNOfUnitTypeRequirement();
   8.174 +			RequiresNoMoreThanNOfUnitTypeRequirement<UnitType> req = new RequiresNoMoreThanNOfUnitTypeRequirement<UnitType>(allowedUnitType);
   8.175  			req.AddUnitTypeRequirement(unitType1, 2);
   8.176  			Assert.That(req.GetAllowsAddingMessage(unitType1, army), Is.EqualTo("Army cannot contain more than: 2 × " + unitType1.Name + " (would have 3)."));
   8.177  		}
   8.178 @@ -204,7 +206,7 @@
   8.179  		public void TestAllowsAddMessageIsCorrectForFailWithTwoUnitsProhibited()
   8.180  		{
   8.181  			Army army = new Army(mockRace, "Test", 1000);
   8.182 -			RequiresNoMoreThanNOfUnitTypeRequirement req = new RequiresNoMoreThanNOfUnitTypeRequirement();
   8.183 +			RequiresNoMoreThanNOfUnitTypeRequirement<UnitType> req = new RequiresNoMoreThanNOfUnitTypeRequirement<UnitType>(allowedUnitType);
   8.184  			req.AddUnitTypeRequirement(unitType1);
   8.185  			req.AddUnitTypeRequirement(unitType2);
   8.186  			Assert.That(req.GetAllowsAddingMessage(unitType1, army), Is.EqualTo("Army cannot contain more than: 0 × " + unitType1.Name + " (would have 1)."));
   8.187 @@ -215,7 +217,7 @@
   8.188  		{
   8.189  			Army army = new Army(mockRace, "Test", 1000);
   8.190  			AddUnitOfTypeToArmy(unitType1, army);
   8.191 -			RequiresNoMoreThanNOfUnitTypeRequirement req = new RequiresNoMoreThanNOfUnitTypeRequirement();
   8.192 +			RequiresNoMoreThanNOfUnitTypeRequirement<UnitType> req = new RequiresNoMoreThanNOfUnitTypeRequirement<UnitType>(allowedUnitType);
   8.193  			req.AddUnitTypeRequirement(unitType1);
   8.194  			req.AddUnitTypeRequirement(unitType2);
   8.195  			Assert.That(req.GetAllowsAddingMessage(unitType2, army), Is.EqualTo("Army cannot contain more than: 0 × " + unitType1.Name + " (would have 1); 0 × " + unitType2.Name + " (would have 1)."));
   8.196 @@ -226,7 +228,7 @@
   8.197  		{
   8.198  			Army army = new Army(mockRace, "Test", 1000);
   8.199  			AddUnitOfTypeToArmy(unitType2, army);
   8.200 -			RequiresNoMoreThanNOfUnitTypeRequirement req = new RequiresNoMoreThanNOfUnitTypeRequirement();
   8.201 +			RequiresNoMoreThanNOfUnitTypeRequirement<UnitType> req = new RequiresNoMoreThanNOfUnitTypeRequirement<UnitType>(allowedUnitType);
   8.202  			req.AddUnitTypeRequirement(unitType1);
   8.203  			req.AddUnitTypeRequirement(unitType2);
   8.204  			Assert.That(req.GetAllowsAddingMessage(unitType1, army), Is.EqualTo("Army cannot contain more than: 0 × " + unitType1.Name + " (would have 1); 0 × " + unitType2.Name + " (would have 1)."));
   8.205 @@ -242,23 +244,23 @@
   8.206  			return new Unit(unitType, army.GetCategory(unitType.MainCategory));
   8.207  		}
   8.208  
   8.209 -		public override RequiresNoMoreThanNOfUnitTypeRequirement GetObject ()
   8.210 +		public override RequiresNoMoreThanNOfUnitTypeRequirement<UnitType> GetObject()
   8.211  		{
   8.212 -			RequiresNoMoreThanNOfUnitTypeRequirement req = new RequiresNoMoreThanNOfUnitTypeRequirement();
   8.213 +			RequiresNoMoreThanNOfUnitTypeRequirement<UnitType> req = new RequiresNoMoreThanNOfUnitTypeRequirement<UnitType>(allowedUnitType);
   8.214  			req.AddUnitTypeRequirement(unitType1, 2);
   8.215  			return req;
   8.216  		}
   8.217  
   8.218 -		public override RequiresNoMoreThanNOfUnitTypeRequirement GetSameObject ()
   8.219 +		public override RequiresNoMoreThanNOfUnitTypeRequirement<UnitType> GetSameObject()
   8.220  		{
   8.221 -			RequiresNoMoreThanNOfUnitTypeRequirement req = new RequiresNoMoreThanNOfUnitTypeRequirement();
   8.222 +			RequiresNoMoreThanNOfUnitTypeRequirement<UnitType> req = new RequiresNoMoreThanNOfUnitTypeRequirement<UnitType>(allowedUnitType);
   8.223  			req.AddUnitTypeRequirement(unitType1, 2);
   8.224  			return req;
   8.225  		}
   8.226  
   8.227 -		public override RequiresNoMoreThanNOfUnitTypeRequirement GetDifferentObject ()
   8.228 +		public override RequiresNoMoreThanNOfUnitTypeRequirement<UnitType> GetDifferentObject()
   8.229  		{
   8.230 -			RequiresNoMoreThanNOfUnitTypeRequirement req = new RequiresNoMoreThanNOfUnitTypeRequirement();
   8.231 +			RequiresNoMoreThanNOfUnitTypeRequirement<UnitType> req = new RequiresNoMoreThanNOfUnitTypeRequirement<UnitType>(allowedUnitType);
   8.232  			DummyWarFoundryFactory factory = new DummyWarFoundryFactory();
   8.233  			GameSystem gameSystem = new GameSystem("system", "system", factory);
   8.234  			Race race = new Race("race", "race", gameSystem, factory);
     9.1 --- a/API/Objects/Requirement/UnitRequiresAtLeastNUnitsRequirementTest.cs	Tue Jan 31 20:59:15 2012 +0000
     9.2 +++ b/API/Objects/Requirement/UnitRequiresAtLeastNUnitsRequirementTest.cs	Wed Feb 22 20:48:40 2012 +0000
     9.3 @@ -213,7 +213,7 @@
     9.4  		{
     9.5  			Army army = new Army(mockRace, "Test", 1000);
     9.6  			AddUnitOfTypeToArmy(unitType1, army);
     9.7 -			RequiresAtLeastNUnitsRequirement req = new UnitRequiresAtLeastNUnitsRequirement(unitType1);
     9.8 +			UnitRequiresAtLeastNUnitsRequirement req = new UnitRequiresAtLeastNUnitsRequirement(unitType1);
     9.9  			req.AddUnitTypeRequirement(unitType2, 2);
    9.10  			Assert.That(req.AllowsAdding(unitType2, army), Is.EqualTo(Validation.Failed));
    9.11  			AddUnitOfTypeToArmy(unitType2, army);
    9.12 @@ -226,7 +226,7 @@
    9.13  			Army army = new Army(mockRace, "Test", 1000);
    9.14  			AddUnitOfTypeToArmy(unitType1, army);
    9.15  			AddUnitOfTypeToArmy(unitType2, army);
    9.16 -			RequiresAtLeastNUnitsRequirement req = new UnitRequiresAtLeastNUnitsRequirement(unitType1);
    9.17 +			UnitRequiresAtLeastNUnitsRequirement req = new UnitRequiresAtLeastNUnitsRequirement(unitType1);
    9.18  			req.AddUnitTypeRequirement(unitType2);
    9.19  			Assert.That(req.GetValidationMessage(army), Is.Empty);
    9.20  		}
    9.21 @@ -236,7 +236,7 @@
    9.22  		{
    9.23  			Army army = new Army(mockRace, "Test", 1000);
    9.24  			AddUnitOfTypeToArmy(unitType1, army);
    9.25 -			RequiresAtLeastNUnitsRequirement req = new UnitRequiresAtLeastNUnitsRequirement(unitType1);
    9.26 +			UnitRequiresAtLeastNUnitsRequirement req = new UnitRequiresAtLeastNUnitsRequirement(unitType1);
    9.27  			req.AddUnitTypeRequirement(unitType2);
    9.28  			Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " (have 0)."));
    9.29  		}
    9.30 @@ -246,7 +246,7 @@
    9.31  		{
    9.32  			Army army = new Army(mockRace, "Test", 1000);
    9.33  			AddUnitOfTypeToArmy(unitType1, army);
    9.34 -			RequiresAtLeastNUnitsRequirement req = new UnitRequiresAtLeastNUnitsRequirement(unitType1);
    9.35 +			UnitRequiresAtLeastNUnitsRequirement req = new UnitRequiresAtLeastNUnitsRequirement(unitType1);
    9.36  			req.AddUnitTypeRequirement(unitType2, 2);
    9.37  			Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 2 × " + unitType2.Name + " (have 0)."));
    9.38  		}
    9.39 @@ -256,7 +256,7 @@
    9.40  		{
    9.41  			Army army = new Army(mockRace, "Test", 1000);
    9.42  			AddUnitOfTypeToArmy(unitType1, army);
    9.43 -			RequiresAtLeastNUnitsRequirement req = new UnitRequiresAtLeastNUnitsRequirement(unitType1);
    9.44 +			UnitRequiresAtLeastNUnitsRequirement req = new UnitRequiresAtLeastNUnitsRequirement(unitType1);
    9.45  			req.AddUnitTypeRequirement(unitType2);
    9.46  			req.AddUnitTypeRequirement(unitType3);
    9.47  			Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " (have 0); 1 × " + unitType3.Name + " (have 0)."));
    9.48 @@ -267,7 +267,7 @@
    9.49  		{
    9.50  			Army army = new Army(mockRace, "Test", 1000);
    9.51  			AddUnitOfTypeToArmy(unitType1, army);
    9.52 -			RequiresAtLeastNUnitsRequirement req = new UnitRequiresAtLeastNUnitsRequirement(unitType1);
    9.53 +			UnitRequiresAtLeastNUnitsRequirement req = new UnitRequiresAtLeastNUnitsRequirement(unitType1);
    9.54  			Assert.That(req.GetAllowsAddingMessage(unitType1, army), Is.Empty);
    9.55  		}
    9.56  
    9.57 @@ -275,7 +275,7 @@
    9.58  		public void TestAllowsAddingMessageIsCorrectForFailWithTwoOfOneUnitRequired()
    9.59  		{
    9.60  			Army army = new Army(mockRace, "Test", 1000);
    9.61 -			RequiresAtLeastNUnitsRequirement req = new UnitRequiresAtLeastNUnitsRequirement(unitType1);
    9.62 +			UnitRequiresAtLeastNUnitsRequirement req = new UnitRequiresAtLeastNUnitsRequirement(unitType1);
    9.63  			req.AddUnitTypeRequirement(unitType2, 2);
    9.64  			Assert.That(req.GetAllowsAddingMessage(unitType2, army), Is.EqualTo("Army must contain: 2 × " + unitType2.Name + " (would have 1)."));
    9.65  		}
    9.66 @@ -284,7 +284,7 @@
    9.67  		public void TestAllowsAddingMessageIsCorrectForFailWithTwoUnitsRequired()
    9.68  		{
    9.69  			Army army = new Army(mockRace, "Test", 1000);
    9.70 -			RequiresAtLeastNUnitsRequirement req = new UnitRequiresAtLeastNUnitsRequirement(unitType1);
    9.71 +			UnitRequiresAtLeastNUnitsRequirement req = new UnitRequiresAtLeastNUnitsRequirement(unitType1);
    9.72  			req.AddUnitTypeRequirement(unitType2);
    9.73  			req.AddUnitTypeRequirement(unitType3);
    9.74  			Assert.That(req.GetAllowsAddingMessage(unitType2, army), Is.EqualTo("Army must contain: 1 × " + unitType3.Name + " (would have 0)."));
    9.75 @@ -294,7 +294,7 @@
    9.76  		public void TestAllowsAddingMessageIsCorrectForFailWithTwoUnitsRequiredOtherUnit()
    9.77  		{
    9.78  			Army army = new Army(mockRace, "Test", 1000);
    9.79 -			RequiresAtLeastNUnitsRequirement req = new UnitRequiresAtLeastNUnitsRequirement(unitType1);
    9.80 +			UnitRequiresAtLeastNUnitsRequirement req = new UnitRequiresAtLeastNUnitsRequirement(unitType1);
    9.81  			req.AddUnitTypeRequirement(unitType2);
    9.82  			req.AddUnitTypeRequirement(unitType3);
    9.83  			Assert.That(req.GetAllowsAddingMessage(unitType3, army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " (would have 0)."));
    9.84 @@ -305,7 +305,7 @@
    9.85  		{
    9.86  			Army army = new Army(mockRace, "Test", 1000);
    9.87  			AddUnitOfTypeToArmy(unitType2, army);
    9.88 -			RequiresAtLeastNUnitsRequirement req = new UnitRequiresAtLeastNUnitsRequirement(unitType1);
    9.89 +			UnitRequiresAtLeastNUnitsRequirement req = new UnitRequiresAtLeastNUnitsRequirement(unitType1);
    9.90  			req.AddUnitTypeRequirement(unitType2);
    9.91  			req.AddUnitTypeRequirement(unitType3);
    9.92  			Assert.That(req.GetAllowsAddingMessage(unitType2, army), Is.EqualTo("Army must contain: 1 × " + unitType3.Name + " (would have 0)."));
    9.93 @@ -316,7 +316,7 @@
    9.94  		{
    9.95  			Army army = new Army(mockRace, "Test", 1000);
    9.96  			AddUnitOfTypeToArmy(unitType3, army);
    9.97 -			RequiresAtLeastNUnitsRequirement req = new UnitRequiresAtLeastNUnitsRequirement(unitType1);
    9.98 +			UnitRequiresAtLeastNUnitsRequirement req = new UnitRequiresAtLeastNUnitsRequirement(unitType1);
    9.99  			req.AddUnitTypeRequirement(unitType2);
   9.100  			req.AddUnitTypeRequirement(unitType3);
   9.101  			Assert.That(req.GetAllowsAddingMessage(unitType3, army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " (would have 0)."));
    10.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.2 +++ b/API/Objects/Requirement/UnitRequiresNUnitsForMUnitsRequirementTests.cs	Wed Feb 22 20:48:40 2012 +0000
    10.3 @@ -0,0 +1,294 @@
    10.4 +// This file (UnitRequiresNUnitsForMUnitsRequirementTest.cs) is a part of the IBBoard.WarFoundry.API.Tests project and is copyright 2011 IBBoard
    10.5 +// 
    10.6 +// 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.
    10.7 +using System;
    10.8 +using NUnit.Framework;
    10.9 +using IBBoard.WarFoundry.API.Objects.Mock;
   10.10 +using NUnit.Framework.SyntaxHelpers;
   10.11 +
   10.12 +namespace IBBoard.WarFoundry.API.Objects.Requirement
   10.13 +{
   10.14 +	[TestFixture()]
   10.15 +	public class UnitRequiresNUnitsForMUnitsRequirementTests
   10.16 +	{
   10.17 +		private MockRace mockRace;
   10.18 +		private UnitType unitType1;
   10.19 +		private UnitType unitType2;
   10.20 +		private UnitType unitType3;
   10.21 +
   10.22 +		[TestFixtureSetUp()]
   10.23 +		public void SetupRace()
   10.24 +		{
   10.25 +			mockRace = new MockRace();
   10.26 +			unitType1 = new MockUnitType("type1", "Unit Type 1");
   10.27 +			mockRace.AddUnitType(unitType1);
   10.28 +			unitType2 = new MockUnitType("type2", "Unit Type 2");
   10.29 +			mockRace.AddUnitType(unitType2);
   10.30 +			unitType3 = new MockUnitType("type3", "Unit Type 3");
   10.31 +			mockRace.AddUnitType(unitType3);
   10.32 +		}
   10.33 +
   10.34 +		[Test()]
   10.35 +		public void TestAddingUnitWithNoUnitsAndOneUnitTypeRequiredIsAllowed()
   10.36 +		{
   10.37 +			Army army = new Army(mockRace, "Test", 1000);
   10.38 +			Unit unit = CreateUnitOfType(unitType1, army);
   10.39 +			UnitRequiresNUnitsForMUnitsRequirement req = new UnitRequiresNUnitsForMUnitsRequirement(unitType1);
   10.40 +			req.AddUnitTypeRequirement(unitType2);
   10.41 +			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Passed));
   10.42 +		}
   10.43 +
   10.44 +		[Test()]
   10.45 +		public void TestAddingUnitWithOneUnitAndOneUnitTypeRequiredIsNotAllowed()
   10.46 +		{
   10.47 +			Army army = new Army(mockRace, "Test", 1000);
   10.48 +			AddUnitOfTypeToArmy(unitType2, army);
   10.49 +			Unit unit = CreateUnitOfType(unitType1, army);
   10.50 +			UnitRequiresNUnitsForMUnitsRequirement req = new UnitRequiresNUnitsForMUnitsRequirement(unitType1);
   10.51 +			req.AddUnitTypeRequirement(unitType2);
   10.52 +			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed));
   10.53 +		}
   10.54 +
   10.55 +		[Test()]
   10.56 +		public void TestAddingUnitTypeWithNoUnitsAndOneUnitTypeRequiredIsAllowed()
   10.57 +		{
   10.58 +			Army army = new Army(mockRace, "Test", 1000);
   10.59 +			UnitRequiresNUnitsForMUnitsRequirement req = new UnitRequiresNUnitsForMUnitsRequirement(unitType1);
   10.60 +			req.AddUnitTypeRequirement(unitType2);
   10.61 +			Assert.That(req.AllowsAdding(unitType1, army), Is.EqualTo(Validation.Passed));
   10.62 +		}
   10.63 +
   10.64 +		[Test()]
   10.65 +		public void TestAddingUnitTypeWithOneUnitAndOneUnitTypeRequiredIsNotAllowed()
   10.66 +		{
   10.67 +			Army army = new Army(mockRace, "Test", 1000);
   10.68 +			AddUnitOfTypeToArmy(unitType2, army);
   10.69 +			UnitRequiresNUnitsForMUnitsRequirement req = new UnitRequiresNUnitsForMUnitsRequirement(unitType1);
   10.70 +			req.AddUnitTypeRequirement(unitType2);
   10.71 +			Assert.That(req.AllowsAdding(unitType1, army), Is.EqualTo(Validation.Failed));
   10.72 +		}
   10.73 +
   10.74 +		[Test()]
   10.75 +		public void TestAddingUnitTypeSetsLimit()
   10.76 +		{
   10.77 +			Army army = new Army(mockRace, "Test", 1000);
   10.78 +			AddUnitOfTypeToArmy(unitType2, army);
   10.79 +			UnitRequiresNUnitsForMUnitsRequirement req = new UnitRequiresNUnitsForMUnitsRequirement(unitType1);
   10.80 +			req.AddUnitTypeRequirement(unitType2, 1);
   10.81 +			Assert.That(req.AllowsAdding(unitType1, army), Is.EqualTo(Validation.Passed));
   10.82 +		}
   10.83 +
   10.84 +		[Test()]
   10.85 +		public void TestAddingUnitTypeSetsLimitForFailure()
   10.86 +		{
   10.87 +			Army army = new Army(mockRace, "Test", 1000);
   10.88 +			AddUnitOfTypeToArmy(unitType2, army);
   10.89 +			AddUnitOfTypeToArmy(unitType2, army);
   10.90 +			UnitRequiresNUnitsForMUnitsRequirement req = new UnitRequiresNUnitsForMUnitsRequirement(unitType1);
   10.91 +			req.AddUnitTypeRequirement(unitType2, 1);
   10.92 +			Assert.That(req.AllowsAdding(unitType1, army), Is.EqualTo(Validation.Failed));
   10.93 +		}
   10.94 +
   10.95 +		[Test()]
   10.96 +		public void TestAddingUnitTriggersFailure()
   10.97 +		{
   10.98 +			Army army = new Army(mockRace, "Test", 1000);
   10.99 +			AddUnitOfTypeToArmy(unitType2, army);
  10.100 +			UnitRequiresNUnitsForMUnitsRequirement req = new UnitRequiresNUnitsForMUnitsRequirement(unitType1);
  10.101 +			req.AddUnitTypeRequirement(unitType2, 1);
  10.102 +			Assert.That(req.AllowsAdding(unitType1, army), Is.EqualTo(Validation.Passed));
  10.103 +			AddUnitOfTypeToArmy(unitType2, army);
  10.104 +			Assert.That(req.AllowsAdding(unitType1, army), Is.EqualTo(Validation.Failed));
  10.105 +		}
  10.106 +
  10.107 +		[Test()]
  10.108 +		public void TestAddingUnitTypeDefaultsToNoMoreThanZero()
  10.109 +		{
  10.110 +			Army army = new Army(mockRace, "Test", 1000);
  10.111 +			UnitRequiresNUnitsForMUnitsRequirement req = new UnitRequiresNUnitsForMUnitsRequirement(unitType1);
  10.112 +			req.AddUnitTypeRequirement(unitType2);
  10.113 +			Assert.That(req.AllowsAdding(unitType1, army), Is.EqualTo(Validation.Passed));
  10.114 +			AddUnitOfTypeToArmy(unitType2, army);
  10.115 +			Assert.That(req.AllowsAdding(unitType1, army), Is.EqualTo(Validation.Failed));
  10.116 +		}
  10.117 +
  10.118 +		[Test]
  10.119 +		public void TestRequirementNotApplicableWhenLimitedUnitNotIncluded()
  10.120 +		{
  10.121 +			Army army = new Army(mockRace, "Test", 1000);
  10.122 +			UnitRequiresNUnitsForMUnitsRequirement req = new UnitRequiresNUnitsForMUnitsRequirement(unitType1);
  10.123 +			req.AddUnitTypeRequirement(unitType2);
  10.124 +			Assert.That(req.AllowsAdding(unitType3, army), Is.EqualTo(Validation.NotApplicable));
  10.125 +			Assert.That(req.AllowsAdding(unitType2, army), Is.EqualTo(Validation.NotApplicable));
  10.126 +		}
  10.127 +
  10.128 +		[Test]
  10.129 +		public void TestRequirementBecomesInvalidWhenProhibitedUnitsChange()
  10.130 +		{
  10.131 +			Army army = new Army(mockRace, "Test", 1000);
  10.132 +			AddUnitOfTypeToArmy(unitType1, army);
  10.133 +			UnitRequiresNUnitsForMUnitsRequirement req = new UnitRequiresNUnitsForMUnitsRequirement(unitType1);
  10.134 +			req.AddUnitTypeRequirement(unitType2);
  10.135 +			Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Passed));
  10.136 +			AddUnitOfTypeToArmy(unitType2, army);
  10.137 +			Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Failed));
  10.138 +		}
  10.139 +
  10.140 +		[Test()]
  10.141 +		public void TestAddingLimitedUnitTriggersFailure()
  10.142 +		{
  10.143 +			Army army = new Army(mockRace, "Test", 1000);
  10.144 +			AddUnitOfTypeToArmy(unitType1, army);
  10.145 +			UnitRequiresNUnitsForMUnitsRequirement req = new UnitRequiresNUnitsForMUnitsRequirement(unitType1);
  10.146 +			req.AddUnitTypeRequirement(unitType2);
  10.147 +			Assert.That(req.AllowsAdding(unitType2, army), Is.EqualTo(Validation.Failed));
  10.148 +		}
  10.149 +
  10.150 +		[Test]
  10.151 +		public void TestValidationMessageIsBlankForPass()
  10.152 +		{
  10.153 +			Army army = new Army(mockRace, "Test", 1000);
  10.154 +			UnitRequiresNUnitsForMUnitsRequirement req = new UnitRequiresNUnitsForMUnitsRequirement(unitType1);
  10.155 +			req.AddUnitTypeRequirement(unitType2);
  10.156 +			Assert.That(req.GetValidationMessage(army), Is.Empty);
  10.157 +		}
  10.158 +
  10.159 +		[Test]
  10.160 +		public void TestValidationMessageIsCorrectForFailWithOneUnitProhibited()
  10.161 +		{
  10.162 +			Army army = new Army(mockRace, "Test", 1000);
  10.163 +			AddUnitOfTypeToArmy(unitType1, army);
  10.164 +			AddUnitOfTypeToArmy(unitType2, army);
  10.165 +			UnitRequiresNUnitsForMUnitsRequirement req = new UnitRequiresNUnitsForMUnitsRequirement(unitType1);
  10.166 +			req.AddUnitTypeRequirement(unitType2);
  10.167 +			Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army cannot contain more than: 0 × " + unitType2.Name + " (have 1)."));
  10.168 +		}
  10.169 +
  10.170 +		[Test]
  10.171 +		public void TestValidationMessageIsCorrectForFailWithTwoOfOneUnitLimit()
  10.172 +		{
  10.173 +			Army army = new Army(mockRace, "Test", 1000);
  10.174 +			AddUnitOfTypeToArmy(unitType1, army);
  10.175 +			AddUnitOfTypeToArmy(unitType2, army);
  10.176 +			AddUnitOfTypeToArmy(unitType2, army);
  10.177 +			AddUnitOfTypeToArmy(unitType2, army);
  10.178 +			UnitRequiresNUnitsForMUnitsRequirement req = new UnitRequiresNUnitsForMUnitsRequirement(unitType1);
  10.179 +			req.AddUnitTypeRequirement(unitType2, 2);
  10.180 +			Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army cannot contain more than: 2 × " + unitType2.Name + " (have 3)."));
  10.181 +		}
  10.182 +
  10.183 +		[Test]
  10.184 +		public void TestValidationMessageIsCorrectForFailWithTwoUnitsProhibited()
  10.185 +		{
  10.186 +			Army army = new Army(mockRace, "Test", 1000);
  10.187 +			AddUnitOfTypeToArmy(unitType1, army);
  10.188 +			AddUnitOfTypeToArmy(unitType2, army);
  10.189 +			UnitRequiresNUnitsForMUnitsRequirement req = new UnitRequiresNUnitsForMUnitsRequirement(unitType1);
  10.190 +			req.AddUnitTypeRequirement(unitType2);
  10.191 +			req.AddUnitTypeRequirement(unitType3);
  10.192 +			Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army cannot contain more than: 0 × " + unitType2.Name + " (have 1)."));
  10.193 +		}
  10.194 +
  10.195 +		[Test]
  10.196 +		public void TestValidationMessageIsCorrectForFailWithTwoUnitsProhibitedAndOtherUnitInArmy()
  10.197 +		{
  10.198 +			Army army = new Army(mockRace, "Test", 1000);
  10.199 +			AddUnitOfTypeToArmy(unitType1, army);
  10.200 +			AddUnitOfTypeToArmy(unitType3, army);
  10.201 +			UnitRequiresNUnitsForMUnitsRequirement req = new UnitRequiresNUnitsForMUnitsRequirement(unitType1);
  10.202 +			req.AddUnitTypeRequirement(unitType2);
  10.203 +			req.AddUnitTypeRequirement(unitType3);
  10.204 +			Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army cannot contain more than: 0 × " + unitType3.Name + " (have 1)."));
  10.205 +		}
  10.206 +
  10.207 +		[Test]
  10.208 +		public void TestValidationMessageIsCorrectForFailWithTwoUnitsProhibitedAndBothUnitsInArmy()
  10.209 +		{
  10.210 +			Army army = new Army(mockRace, "Test", 1000);
  10.211 +			AddUnitOfTypeToArmy(unitType1, army);
  10.212 +			AddUnitOfTypeToArmy(unitType2, army);
  10.213 +			AddUnitOfTypeToArmy(unitType3, army);
  10.214 +			UnitRequiresNUnitsForMUnitsRequirement req = new UnitRequiresNUnitsForMUnitsRequirement(unitType1);
  10.215 +			req.AddUnitTypeRequirement(unitType2);
  10.216 +			req.AddUnitTypeRequirement(unitType3);
  10.217 +			Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army cannot contain more than: 0 × " + unitType2.Name + " (have 1); 0 × " + unitType3.Name + " (have 1)."));
  10.218 +		}
  10.219 +
  10.220 +		[Test]
  10.221 +		public void TestAllowsAddMessageIsBlankForPass()
  10.222 +		{
  10.223 +			Army army = new Army(mockRace, "Test", 1000);
  10.224 +			AddUnitOfTypeToArmy(unitType1, army);
  10.225 +			UnitRequiresNUnitsForMUnitsRequirement req = new UnitRequiresNUnitsForMUnitsRequirement(unitType1);
  10.226 +			Assert.That(req.GetAllowsAddingMessage(unitType2, army), Is.Empty);
  10.227 +		}
  10.228 +
  10.229 +		[Test]
  10.230 +		public void TestAllowsAddMessageIsCorrectForFailWithOneUnitProhibited()
  10.231 +		{
  10.232 +			Army army = new Army(mockRace, "Test", 1000);
  10.233 +			AddUnitOfTypeToArmy(unitType1, army);
  10.234 +			UnitRequiresNUnitsForMUnitsRequirement req = new UnitRequiresNUnitsForMUnitsRequirement(unitType1);
  10.235 +			req.AddUnitTypeRequirement(unitType2);
  10.236 +			Assert.That(req.GetAllowsAddingMessage(unitType2, army), Is.EqualTo("Army cannot contain more than: 0 × " + unitType2.Name + " (would have 1)."));
  10.237 +		}
  10.238 +
  10.239 +		[Test]
  10.240 +		public void TestAllowsAddMessageIsCorrectForFailWithTwoOfOneUnitLimit()
  10.241 +		{
  10.242 +			Army army = new Army(mockRace, "Test", 1000);
  10.243 +			AddUnitOfTypeToArmy(unitType1, army);
  10.244 +			AddUnitOfTypeToArmy(unitType2, army);
  10.245 +			AddUnitOfTypeToArmy(unitType2, army);
  10.246 +			UnitRequiresNUnitsForMUnitsRequirement req = new UnitRequiresNUnitsForMUnitsRequirement(unitType1);
  10.247 +			req.AddUnitTypeRequirement(unitType2, 2);
  10.248 +			Assert.That(req.GetAllowsAddingMessage(unitType2, army), Is.EqualTo("Army cannot contain more than: 2 × " + unitType2.Name + " (would have 3)."));
  10.249 +		}
  10.250 +
  10.251 +		[Test]
  10.252 +		public void TestAllowsAddMessageIsCorrectForFailWithTwoUnitsProhibited()
  10.253 +		{
  10.254 +			Army army = new Army(mockRace, "Test", 1000);
  10.255 +			AddUnitOfTypeToArmy(unitType1, army);
  10.256 +			UnitRequiresNUnitsForMUnitsRequirement req = new UnitRequiresNUnitsForMUnitsRequirement(unitType1);
  10.257 +			req.AddUnitTypeRequirement(unitType2);
  10.258 +			req.AddUnitTypeRequirement(unitType3);
  10.259 +			Assert.That(req.GetAllowsAddingMessage(unitType2, army), Is.EqualTo("Army cannot contain more than: 0 × " + unitType2.Name + " (would have 1)."));
  10.260 +		}
  10.261 +
  10.262 +		[Test]
  10.263 +		public void TestAllowsAddMessageIsCorrectForFailWithTwoUnitsProhibitedAndOneUnitInArmy()
  10.264 +		{
  10.265 +			Army army = new Army(mockRace, "Test", 1000);
  10.266 +			AddUnitOfTypeToArmy(unitType1, army);
  10.267 +			AddUnitOfTypeToArmy(unitType2, army);
  10.268 +			UnitRequiresNUnitsForMUnitsRequirement req = new UnitRequiresNUnitsForMUnitsRequirement(unitType1);
  10.269 +			req.AddUnitTypeRequirement(unitType2);
  10.270 +			req.AddUnitTypeRequirement(unitType3);
  10.271 +			Assert.That(req.GetAllowsAddingMessage(unitType3, army), Is.EqualTo("Army cannot contain more than: 0 × " + unitType2.Name + " (would have 1); 0 × " + unitType3.Name + " (would have 1)."));
  10.272 +		}
  10.273 +
  10.274 +		[Test]
  10.275 +		public void TestAllowsAddMessageIsCorrectForFailWithTwoUnitsProhibitedAndOtherUnitInArmy()
  10.276 +		{
  10.277 +			Army army = new Army(mockRace, "Test", 1000);
  10.278 +			AddUnitOfTypeToArmy(unitType1, army);
  10.279 +			AddUnitOfTypeToArmy(unitType3, army);
  10.280 +			UnitRequiresNUnitsForMUnitsRequirement req = new UnitRequiresNUnitsForMUnitsRequirement(unitType1);
  10.281 +			req.AddUnitTypeRequirement(unitType2);
  10.282 +			req.AddUnitTypeRequirement(unitType3);
  10.283 +			Assert.That(req.GetAllowsAddingMessage(unitType2, army), Is.EqualTo("Army cannot contain more than: 0 × " + unitType2.Name + " (would have 1); 0 × " + unitType3.Name + " (would have 1)."));
  10.284 +		}
  10.285 +
  10.286 +		private static void AddUnitOfTypeToArmy(UnitType unitType, Army army)
  10.287 +		{
  10.288 +			army.AddUnit(CreateUnitOfType(unitType, army));
  10.289 +		}
  10.290 +
  10.291 +		private static Unit CreateUnitOfType(UnitType unitType, Army army)
  10.292 +		{
  10.293 +			return new Unit(unitType, army.GetCategory(unitType.MainCategory));
  10.294 +		}
  10.295 +	}
  10.296 +}
  10.297 +
    11.1 --- a/API/Objects/Requirement/UnitRequiresNoMoreThanNOfUnitTypeRequirementTest.cs	Tue Jan 31 20:59:15 2012 +0000
    11.2 +++ b/API/Objects/Requirement/UnitRequiresNoMoreThanNOfUnitTypeRequirementTest.cs	Wed Feb 22 20:48:40 2012 +0000
    11.3 @@ -33,7 +33,7 @@
    11.4  		{
    11.5  			Army army = new Army(mockRace, "Test", 1000);
    11.6  			Unit unit = CreateUnitOfType(unitType1, army);
    11.7 -			RequiresNoMoreThanNOfUnitTypeRequirement req = new UnitRequiresNoMoreThanNOfUnitTypeRequirement(unitType1);
    11.8 +			UnitRequiresNoMoreThanNOfUnitTypeRequirement req = new UnitRequiresNoMoreThanNOfUnitTypeRequirement(unitType1);
    11.9  			req.AddUnitTypeRequirement(unitType2);
   11.10  			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Passed));
   11.11  		}
   11.12 @@ -44,7 +44,7 @@
   11.13  			Army army = new Army(mockRace, "Test", 1000);
   11.14  			AddUnitOfTypeToArmy(unitType2, army);
   11.15  			Unit unit = CreateUnitOfType(unitType1, army);
   11.16 -			RequiresNoMoreThanNOfUnitTypeRequirement req = new UnitRequiresNoMoreThanNOfUnitTypeRequirement(unitType1);
   11.17 +			UnitRequiresNoMoreThanNOfUnitTypeRequirement req = new UnitRequiresNoMoreThanNOfUnitTypeRequirement(unitType1);
   11.18  			req.AddUnitTypeRequirement(unitType2);
   11.19  			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed));
   11.20  		}
   11.21 @@ -53,7 +53,7 @@
   11.22  		public void TestAddingUnitTypeWithNoUnitsAndOneUnitTypeRequiredIsAllowed()
   11.23  		{
   11.24  			Army army = new Army(mockRace, "Test", 1000);
   11.25 -			RequiresNoMoreThanNOfUnitTypeRequirement req = new UnitRequiresNoMoreThanNOfUnitTypeRequirement(unitType1);
   11.26 +			UnitRequiresNoMoreThanNOfUnitTypeRequirement req = new UnitRequiresNoMoreThanNOfUnitTypeRequirement(unitType1);
   11.27  			req.AddUnitTypeRequirement(unitType2);
   11.28  			Assert.That(req.AllowsAdding(unitType1, army), Is.EqualTo(Validation.Passed));
   11.29  		}
   11.30 @@ -63,7 +63,7 @@
   11.31  		{
   11.32  			Army army = new Army(mockRace, "Test", 1000);
   11.33  			AddUnitOfTypeToArmy(unitType2, army);
   11.34 -			RequiresNoMoreThanNOfUnitTypeRequirement req = new UnitRequiresNoMoreThanNOfUnitTypeRequirement(unitType1);
   11.35 +			UnitRequiresNoMoreThanNOfUnitTypeRequirement req = new UnitRequiresNoMoreThanNOfUnitTypeRequirement(unitType1);
   11.36  			req.AddUnitTypeRequirement(unitType2);
   11.37  			Assert.That(req.AllowsAdding(unitType1, army), Is.EqualTo(Validation.Failed));
   11.38  		}
   11.39 @@ -73,7 +73,7 @@
   11.40  		{
   11.41  			Army army = new Army(mockRace, "Test", 1000);
   11.42  			AddUnitOfTypeToArmy(unitType2, army);
   11.43 -			RequiresNoMoreThanNOfUnitTypeRequirement req = new UnitRequiresNoMoreThanNOfUnitTypeRequirement(unitType1);
   11.44 +			UnitRequiresNoMoreThanNOfUnitTypeRequirement req = new UnitRequiresNoMoreThanNOfUnitTypeRequirement(unitType1);
   11.45  			req.AddUnitTypeRequirement(unitType2, 1);
   11.46  			Assert.That(req.AllowsAdding(unitType1, army), Is.EqualTo(Validation.Passed));
   11.47  		}
   11.48 @@ -84,7 +84,7 @@
   11.49  			Army army = new Army(mockRace, "Test", 1000);
   11.50  			AddUnitOfTypeToArmy(unitType2, army);
   11.51  			AddUnitOfTypeToArmy(unitType2, army);
   11.52 -			RequiresNoMoreThanNOfUnitTypeRequirement req = new UnitRequiresNoMoreThanNOfUnitTypeRequirement(unitType1);
   11.53 +			UnitRequiresNoMoreThanNOfUnitTypeRequirement req = new UnitRequiresNoMoreThanNOfUnitTypeRequirement(unitType1);
   11.54  			req.AddUnitTypeRequirement(unitType2, 1);
   11.55  			Assert.That(req.AllowsAdding(unitType1, army), Is.EqualTo(Validation.Failed));
   11.56  		}
   11.57 @@ -94,7 +94,7 @@
   11.58  		{
   11.59  			Army army = new Army(mockRace, "Test", 1000);
   11.60  			AddUnitOfTypeToArmy(unitType2, army);
   11.61 -			RequiresNoMoreThanNOfUnitTypeRequirement req = new UnitRequiresNoMoreThanNOfUnitTypeRequirement(unitType1);
   11.62 +			UnitRequiresNoMoreThanNOfUnitTypeRequirement req = new UnitRequiresNoMoreThanNOfUnitTypeRequirement(unitType1);
   11.63  			req.AddUnitTypeRequirement(unitType2, 1);
   11.64  			Assert.That(req.AllowsAdding(unitType1, army), Is.EqualTo(Validation.Passed));
   11.65  			AddUnitOfTypeToArmy(unitType2, army);
   11.66 @@ -105,7 +105,7 @@
   11.67  		public void TestAddingUnitTypeDefaultsToNoMoreThanZero()
   11.68  		{
   11.69  			Army army = new Army(mockRace, "Test", 1000);
   11.70 -			RequiresNoMoreThanNOfUnitTypeRequirement req = new UnitRequiresNoMoreThanNOfUnitTypeRequirement(unitType1);
   11.71 +			UnitRequiresNoMoreThanNOfUnitTypeRequirement req = new UnitRequiresNoMoreThanNOfUnitTypeRequirement(unitType1);
   11.72  			req.AddUnitTypeRequirement(unitType2);
   11.73  			Assert.That(req.AllowsAdding(unitType1, army), Is.EqualTo(Validation.Passed));
   11.74  			AddUnitOfTypeToArmy(unitType2, army);
   11.75 @@ -116,7 +116,7 @@
   11.76  		public void TestRequirementNotApplicableWhenLimitedUnitNotIncluded()
   11.77  		{
   11.78  			Army army = new Army(mockRace, "Test", 1000);
   11.79 -			RequiresNoMoreThanNOfUnitTypeRequirement req = new UnitRequiresNoMoreThanNOfUnitTypeRequirement(unitType1);
   11.80 +			UnitRequiresNoMoreThanNOfUnitTypeRequirement req = new UnitRequiresNoMoreThanNOfUnitTypeRequirement(unitType1);
   11.81  			req.AddUnitTypeRequirement(unitType2);
   11.82  			Assert.That(req.AllowsAdding(unitType3, army), Is.EqualTo(Validation.NotApplicable));
   11.83  			Assert.That(req.AllowsAdding(unitType2, army), Is.EqualTo(Validation.NotApplicable));
   11.84 @@ -127,7 +127,7 @@
   11.85  		{
   11.86  			Army army = new Army(mockRace, "Test", 1000);
   11.87  			AddUnitOfTypeToArmy(unitType1, army);
   11.88 -			RequiresNoMoreThanNOfUnitTypeRequirement req = new UnitRequiresNoMoreThanNOfUnitTypeRequirement(unitType1);
   11.89 +			UnitRequiresNoMoreThanNOfUnitTypeRequirement req = new UnitRequiresNoMoreThanNOfUnitTypeRequirement(unitType1);
   11.90  			req.AddUnitTypeRequirement(unitType2);
   11.91  			Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Passed));
   11.92  			AddUnitOfTypeToArmy(unitType2, army);
   11.93 @@ -139,7 +139,7 @@
   11.94  		{
   11.95  			Army army = new Army(mockRace, "Test", 1000);
   11.96  			AddUnitOfTypeToArmy(unitType1, army);
   11.97 -			RequiresNoMoreThanNOfUnitTypeRequirement req = new UnitRequiresNoMoreThanNOfUnitTypeRequirement(unitType1);
   11.98 +			UnitRequiresNoMoreThanNOfUnitTypeRequirement req = new UnitRequiresNoMoreThanNOfUnitTypeRequirement(unitType1);
   11.99  			req.AddUnitTypeRequirement(unitType2);
  11.100  			Assert.That(req.AllowsAdding(unitType2, army), Is.EqualTo(Validation.Failed));
  11.101  		}
  11.102 @@ -148,7 +148,7 @@
  11.103  		public void TestValidationMessageIsBlankForPass()
  11.104  		{
  11.105  			Army army = new Army(mockRace, "Test", 1000);
  11.106 -			RequiresNoMoreThanNOfUnitTypeRequirement req = new UnitRequiresNoMoreThanNOfUnitTypeRequirement(unitType1);
  11.107 +			UnitRequiresNoMoreThanNOfUnitTypeRequirement req = new UnitRequiresNoMoreThanNOfUnitTypeRequirement(unitType1);
  11.108  			req.AddUnitTypeRequirement(unitType2);
  11.109  			Assert.That(req.GetValidationMessage(army), Is.Empty);
  11.110  		}
  11.111 @@ -159,7 +159,7 @@
  11.112  			Army army = new Army(mockRace, "Test", 1000);
  11.113  			AddUnitOfTypeToArmy(unitType1, army);
  11.114  			AddUnitOfTypeToArmy(unitType2, army);
  11.115 -			RequiresNoMoreThanNOfUnitTypeRequirement req = new UnitRequiresNoMoreThanNOfUnitTypeRequirement(unitType1);
  11.116 +			UnitRequiresNoMoreThanNOfUnitTypeRequirement req = new UnitRequiresNoMoreThanNOfUnitTypeRequirement(unitType1);
  11.117  			req.AddUnitTypeRequirement(unitType2);
  11.118  			Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army cannot contain more than: 0 × " + unitType2.Name + " (have 1)."));
  11.119  		}
  11.120 @@ -172,7 +172,7 @@
  11.121  			AddUnitOfTypeToArmy(unitType2, army);
  11.122  			AddUnitOfTypeToArmy(unitType2, army);
  11.123  			AddUnitOfTypeToArmy(unitType2, army);
  11.124 -			RequiresNoMoreThanNOfUnitTypeRequirement req = new UnitRequiresNoMoreThanNOfUnitTypeRequirement(unitType1);
  11.125 +			UnitRequiresNoMoreThanNOfUnitTypeRequirement req = new UnitRequiresNoMoreThanNOfUnitTypeRequirement(unitType1);
  11.126  			req.AddUnitTypeRequirement(unitType2, 2);
  11.127  			Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army cannot contain more than: 2 × " + unitType2.Name + " (have 3)."));
  11.128  		}
  11.129 @@ -183,7 +183,7 @@
  11.130  			Army army = new Army(mockRace, "Test", 1000);
  11.131  			AddUnitOfTypeToArmy(unitType1, army);
  11.132  			AddUnitOfTypeToArmy(unitType2, army);
  11.133 -			RequiresNoMoreThanNOfUnitTypeRequirement req = new UnitRequiresNoMoreThanNOfUnitTypeRequirement(unitType1);
  11.134 +			UnitRequiresNoMoreThanNOfUnitTypeRequirement req = new UnitRequiresNoMoreThanNOfUnitTypeRequirement(unitType1);
  11.135  			req.AddUnitTypeRequirement(unitType2);
  11.136  			req.AddUnitTypeRequirement(unitType3);
  11.137  			Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army cannot contain more than: 0 × " + unitType2.Name + " (have 1)."));
  11.138 @@ -195,7 +195,7 @@
  11.139  			Army army = new Army(mockRace, "Test", 1000);
  11.140  			AddUnitOfTypeToArmy(unitType1, army);
  11.141  			AddUnitOfTypeToArmy(unitType3, army);
  11.142 -			RequiresNoMoreThanNOfUnitTypeRequirement req = new UnitRequiresNoMoreThanNOfUnitTypeRequirement(unitType1);
  11.143 +			UnitRequiresNoMoreThanNOfUnitTypeRequirement req = new UnitRequiresNoMoreThanNOfUnitTypeRequirement(unitType1);
  11.144  			req.AddUnitTypeRequirement(unitType2);
  11.145  			req.AddUnitTypeRequirement(unitType3);
  11.146  			Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army cannot contain more than: 0 × " + unitType3.Name + " (have 1)."));
  11.147 @@ -208,7 +208,7 @@
  11.148  			AddUnitOfTypeToArmy(unitType1, army);
  11.149  			AddUnitOfTypeToArmy(unitType2, army);
  11.150  			AddUnitOfTypeToArmy(unitType3, army);
  11.151 -			RequiresNoMoreThanNOfUnitTypeRequirement req = new UnitRequiresNoMoreThanNOfUnitTypeRequirement(unitType1);
  11.152 +			UnitRequiresNoMoreThanNOfUnitTypeRequirement req = new UnitRequiresNoMoreThanNOfUnitTypeRequirement(unitType1);
  11.153  			req.AddUnitTypeRequirement(unitType2);
  11.154  			req.AddUnitTypeRequirement(unitType3);
  11.155  			Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army cannot contain more than: 0 × " + unitType2.Name + " (have 1); 0 × " + unitType3.Name + " (have 1)."));
  11.156 @@ -219,7 +219,7 @@
  11.157  		{
  11.158  			Army army = new Army(mockRace, "Test", 1000);
  11.159  			AddUnitOfTypeToArmy(unitType1, army);
  11.160 -			RequiresNoMoreThanNOfUnitTypeRequirement req = new UnitRequiresNoMoreThanNOfUnitTypeRequirement(unitType1);
  11.161 +			UnitRequiresNoMoreThanNOfUnitTypeRequirement req = new UnitRequiresNoMoreThanNOfUnitTypeRequirement(unitType1);
  11.162  			Assert.That(req.GetAllowsAddingMessage(unitType2, army), Is.Empty);
  11.163  		}
  11.164  
  11.165 @@ -228,7 +228,7 @@
  11.166  		{
  11.167  			Army army = new Army(mockRace, "Test", 1000);
  11.168  			AddUnitOfTypeToArmy(unitType1, army);
  11.169 -			RequiresNoMoreThanNOfUnitTypeRequirement req = new UnitRequiresNoMoreThanNOfUnitTypeRequirement(unitType1);
  11.170 +			UnitRequiresNoMoreThanNOfUnitTypeRequirement req = new UnitRequiresNoMoreThanNOfUnitTypeRequirement(unitType1);
  11.171  			req.AddUnitTypeRequirement(unitType2);
  11.172  			Assert.That(req.GetAllowsAddingMessage(unitType2, army), Is.EqualTo("Army cannot contain more than: 0 × " + unitType2.Name + " (would have 1)."));
  11.173  		}
  11.174 @@ -240,7 +240,7 @@
  11.175  			AddUnitOfTypeToArmy(unitType1, army);
  11.176  			AddUnitOfTypeToArmy(unitType2, army);
  11.177  			AddUnitOfTypeToArmy(unitType2, army);
  11.178 -			RequiresNoMoreThanNOfUnitTypeRequirement req = new UnitRequiresNoMoreThanNOfUnitTypeRequirement(unitType1);
  11.179 +			UnitRequiresNoMoreThanNOfUnitTypeRequirement req = new UnitRequiresNoMoreThanNOfUnitTypeRequirement(unitType1);
  11.180  			req.AddUnitTypeRequirement(unitType2, 2);
  11.181  			Assert.That(req.GetAllowsAddingMessage(unitType2, army), Is.EqualTo("Army cannot contain more than: 2 × " + unitType2.Name + " (would have 3)."));
  11.182  		}
  11.183 @@ -250,7 +250,7 @@
  11.184  		{
  11.185  			Army army = new Army(mockRace, "Test", 1000);
  11.186  			AddUnitOfTypeToArmy(unitType1, army);
  11.187 -			RequiresNoMoreThanNOfUnitTypeRequirement req = new UnitRequiresNoMoreThanNOfUnitTypeRequirement(unitType1);
  11.188 +			UnitRequiresNoMoreThanNOfUnitTypeRequirement req = new UnitRequiresNoMoreThanNOfUnitTypeRequirement(unitType1);
  11.189  			req.AddUnitTypeRequirement(unitType2);
  11.190  			req.AddUnitTypeRequirement(unitType3);
  11.191  			Assert.That(req.GetAllowsAddingMessage(unitType2, army), Is.EqualTo("Army cannot contain more than: 0 × " + unitType2.Name + " (would have 1)."));
  11.192 @@ -262,7 +262,7 @@
  11.193  			Army army = new Army(mockRace, "Test", 1000);
  11.194  			AddUnitOfTypeToArmy(unitType1, army);
  11.195  			AddUnitOfTypeToArmy(unitType2, army);
  11.196 -			RequiresNoMoreThanNOfUnitTypeRequirement req = new UnitRequiresNoMoreThanNOfUnitTypeRequirement(unitType1);
  11.197 +			UnitRequiresNoMoreThanNOfUnitTypeRequirement req = new UnitRequiresNoMoreThanNOfUnitTypeRequirement(unitType1);
  11.198  			req.AddUnitTypeRequirement(unitType2);
  11.199  			req.AddUnitTypeRequirement(unitType3);
  11.200  			Assert.That(req.GetAllowsAddingMessage(unitType3, army), Is.EqualTo("Army cannot contain more than: 0 × " + unitType2.Name + " (would have 1); 0 × " + unitType3.Name + " (would have 1)."));
  11.201 @@ -274,7 +274,7 @@
  11.202  			Army army = new Army(mockRace, "Test", 1000);
  11.203  			AddUnitOfTypeToArmy(unitType1, army);
  11.204  			AddUnitOfTypeToArmy(unitType3, army);
  11.205 -			RequiresNoMoreThanNOfUnitTypeRequirement req = new UnitRequiresNoMoreThanNOfUnitTypeRequirement(unitType1);
  11.206 +			UnitRequiresNoMoreThanNOfUnitTypeRequirement req = new UnitRequiresNoMoreThanNOfUnitTypeRequirement(unitType1);
  11.207  			req.AddUnitTypeRequirement(unitType2);
  11.208  			req.AddUnitTypeRequirement(unitType3);
  11.209  			Assert.That(req.GetAllowsAddingMessage(unitType2, army), Is.EqualTo("Army cannot contain more than: 0 × " + unitType2.Name + " (would have 1); 0 × " + unitType3.Name + " (would have 1)."));
    12.1 --- a/API/Objects/UnitTypeTest.cs	Tue Jan 31 20:59:15 2012 +0000
    12.2 +++ b/API/Objects/UnitTypeTest.cs	Wed Feb 22 20:48:40 2012 +0000
    12.3 @@ -65,26 +65,27 @@
    12.4  			UnitType unitType = new UnitType("unittype1", "Swordsmen", new MockRace());
    12.5  			unitType.MinNumber = 1;
    12.6  			unitType.MaxNumber = 2;
    12.7 -			Assert.That(unitType.GetRequirements(), Has.Length(2));
    12.8 -			RequiresNoMoreThanNOfUnitTypeRequirement maxLimit = new RequiresNoMoreThanNOfUnitTypeRequirement();
    12.9 -			maxLimit.AddUnitTypeRequirement(unitType, 2);
   12.10 -			Assert.That(unitType.GetRequirements(), Has.Member(maxLimit));
   12.11 -			RequiresAtLeastNUnitsRequirement minLimit = new RequiresAtLeastNUnitsRequirement();
   12.12 -			minLimit.AddUnitTypeRequirement(unitType, 1);
   12.13 -			Assert.That(unitType.GetRequirements(), Has.Member(minLimit));
   12.14 +			Assert.Fail("Needs fixing after changes");
   12.15 +			//Assert.That(unitType.GetRequirements(), Has.Length(2));
   12.16 +			//RequiresNoMoreThanNOfUnitTypeRequirement<OBJECT_TYPE> maxLimit = new RequiresNoMoreThanNOfUnitTypeRequirement<OBJECT_TYPE>();
   12.17 +			//maxLimit.AddUnitTypeRequirement(unitType, 2);
   12.18 +			//Assert.That(unitType.GetRequirements(), Has.Member(maxLimit));
   12.19 +			//RequiresAtLeastNUnitsRequirement minLimit = new RequiresAtLeastNUnitsRequirement();
   12.20 +			//minLimit.AddUnitTypeRequirement(unitType, 1);
   12.21 +			//Assert.That(unitType.GetRequirements(), Has.Member(minLimit));
   12.22  		}
   12.23  
   12.24 -		public override UnitType GetObject ()
   12.25 +		public override UnitType GetObject()
   12.26  		{
   12.27  			return new UnitType("id1", "Type 1", new MockRace());
   12.28  		}
   12.29  
   12.30 -		public override UnitType GetSameObject ()
   12.31 +		public override UnitType GetSameObject()
   12.32  		{
   12.33  			return new UnitType("id1", "Type 1", new MockRace());
   12.34  		}
   12.35  
   12.36 -		public override UnitType GetDifferentObject ()
   12.37 +		public override UnitType GetDifferentObject()
   12.38  		{
   12.39  			DummyWarFoundryFactory factory = new DummyWarFoundryFactory();
   12.40  			GameSystem gameSystem = new GameSystem("system", "system", factory);
    13.1 --- a/IBBoard.WarFoundry.API.Tests.csproj	Tue Jan 31 20:59:15 2012 +0000
    13.2 +++ b/IBBoard.WarFoundry.API.Tests.csproj	Wed Feb 22 20:48:40 2012 +0000
    13.3 @@ -113,10 +113,12 @@
    13.4      <Compile Include="API\Objects\UnitEquipmentRatioSelectionTests.cs" />
    13.5      <Compile Include="API\Objects\UnitEquipmentNumericSelectionTests.cs" />
    13.6      <Compile Include="API\Factories\Requirement\UnitRequiresNoMoreThanNOfUnitTypeRequirementFactoryTest.cs" />
    13.7 -    <Compile Include="API\Objects\Requirement\RequiresNUnitsForMUnitsRequirementTest.cs" />
    13.8      <Compile Include="API\Factories\Requirement\UnitRequiresNUnitsForMUnitsRequirementFactoryTest.cs" />
    13.9      <Compile Include="API\Factories\Mock\FileSearchingWarFoundryFactory.cs" />
   13.10      <Compile Include="API\Objects\ArmyTests.cs" />
   13.11 +    <Compile Include="API\Objects\Requirement\UnitRequiresNUnitsForMUnitsRequirementTests.cs" />
   13.12 +    <Compile Include="API\Objects\Requirement\RequiresNUnitsForMObjectsRequirementTest.cs" />
   13.13 +    <Compile Include="API\Objects\Requirement\Mock\MockRequiresNUnitsForMObjectsRequirement.cs" />
   13.14    </ItemGroup>
   13.15    <ItemGroup>
   13.16      <None Include="app.config" />