changeset 214:1674a499168e

Re #379: * Make all tests test both Unit and UnitType by modifying abstract class's helper methods * Re-implement UnitRequiresAtLeastNUnitsRequirementTest tests (adding and validation) * Remove unused tests from Requires... TODO: Re-implement equality testing
author IBBoard <dev@ibboard.co.uk>
date Sun, 26 Feb 2012 20:18:45 +0000
parents 0416df2ab39b
children 7e7296c0ae1f
files API/Objects/Requirement/AbstractUnitRequirementTest.cs API/Objects/Requirement/RequiresAtLeastNUnitsRequirementTest.cs API/Objects/Requirement/RequiresNUnitsForMObjectsRequirementTest.cs API/Objects/Requirement/RequiresNoMoreThanNOfUnitTypeRequirementTest.cs API/Objects/Requirement/UnitRequiresAtLeastNUnitsRequirementTest.cs API/Objects/Requirement/UnitRequiresNUnitsForMUnitsRequirementTests.cs API/Objects/Requirement/UnitRequiresNoMoreThanNOfUnitTypeRequirementTest.cs IBBoard.WarFoundry.API.Tests.csproj
diffstat 8 files changed, 117 insertions(+), 1580 deletions(-) [+]
line diff
     1.1 --- a/API/Objects/Requirement/AbstractUnitRequirementTest.cs	Sun Feb 26 15:38:13 2012 +0000
     1.2 +++ b/API/Objects/Requirement/AbstractUnitRequirementTest.cs	Sun Feb 26 20:18:45 2012 +0000
     1.3 @@ -16,10 +16,7 @@
     1.4  		{
     1.5  			Assert.That(req.AllowsAdding(unitType, army), Is.EqualTo(Validation.Passed));
     1.6  			Assert.That(req.GetAllowsAddingMessage(unitType, army), Is.Empty);
     1.7 -		}
     1.8 -
     1.9 -		protected static void Assert_That__PassesAdding(AbstractUnitRequirement<OBJECT_TYPE> req, Unit unit, Army army)
    1.10 -		{
    1.11 +			Unit unit = CreateUnitOfType(unitType, army);
    1.12  			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Passed));
    1.13  			Assert.That(req.GetAllowsAddingMessage(unit, army), Is.Empty);
    1.14  		}
    1.15 @@ -28,10 +25,7 @@
    1.16  		{
    1.17  			Assert.That(req.AllowsAdding(unitType, army), Is.EqualTo(Validation.NotApplicable));
    1.18  			Assert.That(req.GetAllowsAddingMessage(unitType, army), Is.Empty);
    1.19 -		}
    1.20 -
    1.21 -		protected static void Assert_That__AddingNotApplicable(AbstractUnitRequirement<OBJECT_TYPE> req, Unit unit, Army army)
    1.22 -		{
    1.23 +			Unit unit = CreateUnitOfType(unitType, army);
    1.24  			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.NotApplicable));
    1.25  			Assert.That(req.GetAllowsAddingMessage(unit, army), Is.Empty);
    1.26  		}
    1.27 @@ -40,10 +34,7 @@
    1.28  		{
    1.29  			Assert.That(req.AllowsAdding(unitType, army), Is.EqualTo(Validation.Failed));
    1.30  			Assert.That(req.GetAllowsAddingMessage(unitType, army), Is.EqualTo(message));
    1.31 -		}
    1.32 -
    1.33 -		protected static void Assert_That__FailsAdding(AbstractUnitRequirement<OBJECT_TYPE> req, Unit unit, Army army, string message)
    1.34 -		{
    1.35 +			Unit unit = CreateUnitOfType(unitType, army);
    1.36  			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed));
    1.37  			Assert.That(req.GetAllowsAddingMessage(unit, army), Is.EqualTo(message));
    1.38  		}
     2.1 --- a/API/Objects/Requirement/RequiresAtLeastNUnitsRequirementTest.cs	Sun Feb 26 15:38:13 2012 +0000
     2.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.3 @@ -1,327 +0,0 @@
     2.4 -// This file (UnitRequiresAtLeastNUnitsRequirement.cs) is a part of the IBBoard.WarFoundry.API.Tests project and is copyright 2011 IBBoard
     2.5 -// 
     2.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.
     2.7 -using System;
     2.8 -using NUnit.Framework;
     2.9 -using IBBoard.WarFoundry.API.Objects.Mock;
    2.10 -using NUnit.Framework.SyntaxHelpers;
    2.11 -using System.Reflection;
    2.12 -using IBBoard.NUnit;
    2.13 -using IBBoard.WarFoundry.API.Factories;
    2.14 -
    2.15 -namespace IBBoard.WarFoundry.API.Objects.Requirement
    2.16 -{
    2.17 -	[TestFixture()]
    2.18 -	public class RequiresAtLeastNUnitsRequirementTest : AbstractEqualityTest<RequiresAtLeastNUnitsRequirement<UnitType>>
    2.19 -	{
    2.20 -		private MockRace mockRace;
    2.21 -		private UnitType allowedUnitType;
    2.22 -		private UnitType unitType1;
    2.23 -		private UnitType unitType2;
    2.24 -		private UnitType unitType3;
    2.25 -
    2.26 -		[TestFixtureSetUp()]
    2.27 -		public void SetupRace()
    2.28 -		{
    2.29 -			mockRace = new MockRace();
    2.30 -			allowedUnitType = new MockUnitType("allowed", "Allowed Type");
    2.31 -			mockRace.AddUnitType(allowedUnitType);
    2.32 -			unitType1 = new MockUnitType("type1", "Unit Type 1");
    2.33 -			mockRace.AddUnitType(unitType1);
    2.34 -			unitType2 = new MockUnitType("type2", "Unit Type 2");
    2.35 -			mockRace.AddUnitType(unitType2);
    2.36 -			unitType3 = new MockUnitType("type3", "Unit Type 3");
    2.37 -			mockRace.AddUnitType(unitType3);
    2.38 -		}
    2.39 -
    2.40 -		[Test()]
    2.41 -		public void TestAddingUnrelatedUnitWithNoUnitsAndOneUnitTypeRequired()
    2.42 -		{
    2.43 -			Army army = new Army(mockRace, "Test", 1000);
    2.44 -			Unit unit = CreateUnitOfType(unitType1, army);
    2.45 -			RequiresAtLeastNUnitsRequirement<UnitType> req = new RequiresAtLeastNUnitsRequirement<UnitType>(allowedUnitType, unitType2);
    2.46 -			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.NotApplicable));
    2.47 -		}
    2.48 -
    2.49 -		[Test()]
    2.50 -		public void TestAddingOneUnitWithOneUnitTypeRequired()
    2.51 -		{
    2.52 -			Army army = new Army(mockRace, "Test", 1000);
    2.53 -			Unit unit = CreateUnitOfType(unitType1, army);
    2.54 -			RequiresAtLeastNUnitsRequirement<UnitType> req = new RequiresAtLeastNUnitsRequirement<UnitType>(allowedUnitType, unitType1);
    2.55 -			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Passed));
    2.56 -		}
    2.57 -
    2.58 -		[Test()]
    2.59 -		public void TestAddingUnitWithOneUnitAndTwoOfUnitTypeRequired()
    2.60 -		{
    2.61 -			Army army = new Army(mockRace, "Test", 1000);
    2.62 -			RequiresAtLeastNUnitsRequirement<UnitType> req = new RequiresAtLeastNUnitsRequirement<UnitType>(allowedUnitType);
    2.63 -			req.AddUnitTypeRequirement(unitType1, 2);
    2.64 -			AddUnitOfTypeToArmy(unitType1, army);
    2.65 -			Unit unit = CreateUnitOfType(unitType1, army);
    2.66 -			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Passed));
    2.67 -		}
    2.68 -
    2.69 -		[Test()]
    2.70 -		public void TestAddingUnrelatedUnitTypeWithNoUnitsAndOneUnitTypeRequired()
    2.71 -		{
    2.72 -			Army army = new Army(mockRace, "Test", 1000);
    2.73 -			RequiresAtLeastNUnitsRequirement<UnitType> req = new RequiresAtLeastNUnitsRequirement<UnitType>(allowedUnitType, unitType2);
    2.74 -			Assert.That(req.AllowsAdding(unitType1, army), Is.EqualTo(Validation.NotApplicable));
    2.75 -		}
    2.76 -
    2.77 -		[Test()]
    2.78 -		public void TestAddingUnitTypeWithNoUnitsAndOneUnitTypeRequired()
    2.79 -		{
    2.80 -			Army army = new Army(mockRace, "Test", 1000);
    2.81 -			RequiresAtLeastNUnitsRequirement<UnitType> req = new RequiresAtLeastNUnitsRequirement<UnitType>(allowedUnitType, unitType1);
    2.82 -			Assert.That(req.AllowsAdding(unitType1, army), Is.EqualTo(Validation.Passed));
    2.83 -		}
    2.84 -
    2.85 -		[Test()]
    2.86 -		public void TestAddingUnitTypeWithOneUnitAndOneUnitTypeRequired()
    2.87 -		{
    2.88 -			Army army = new Army(mockRace, "Test", 1000);
    2.89 -			AddUnitOfTypeToArmy(unitType1, army);
    2.90 -			RequiresAtLeastNUnitsRequirement<UnitType> req = new RequiresAtLeastNUnitsRequirement<UnitType>(allowedUnitType, unitType1);
    2.91 -			Assert.That(req.AllowsAdding(unitType1, army), Is.EqualTo(Validation.Passed));
    2.92 -		}
    2.93 -
    2.94 -		[Test()]
    2.95 -		public void TestAddingUnitTypeWithNoUnitsAndTwoUnitTypesRequired()
    2.96 -		{
    2.97 -			Army army = new Army(mockRace, "Test", 1000);
    2.98 -			RequiresAtLeastNUnitsRequirement<UnitType> req = new RequiresAtLeastNUnitsRequirement<UnitType>(allowedUnitType, unitType2, unitType3);
    2.99 -			Assert.That(req.AllowsAdding(unitType2, army), Is.EqualTo(Validation.Failed));
   2.100 -		}
   2.101 -
   2.102 -		[Test()]
   2.103 -		public void TestAddingUnitTypeWithOneUnitAndTwoUnitTypesRequired()
   2.104 -		{
   2.105 -			Army army = new Army(mockRace, "Test", 1000);
   2.106 -			AddUnitOfTypeToArmy(unitType3, army);
   2.107 -			RequiresAtLeastNUnitsRequirement<UnitType> req = new RequiresAtLeastNUnitsRequirement<UnitType>(allowedUnitType, unitType2, unitType3);
   2.108 -			Assert.That(req.AllowsAdding(unitType2, army), Is.EqualTo(Validation.Passed));
   2.109 -		}
   2.110 -
   2.111 -		[Test()]
   2.112 -		public void TestAddingUnitTypeWithBothUnitsAndTwoUnitTypesRequired()
   2.113 -		{
   2.114 -			Army army = new Army(mockRace, "Test", 1000);
   2.115 -			AddUnitOfTypeToArmy(unitType2, army);
   2.116 -			AddUnitOfTypeToArmy(unitType3, army);
   2.117 -			RequiresAtLeastNUnitsRequirement<UnitType> req = new RequiresAtLeastNUnitsRequirement<UnitType>(allowedUnitType, unitType2, unitType3);
   2.118 -			Assert.That(req.AllowsAdding(unitType2, army), Is.EqualTo(Validation.Passed));
   2.119 -		}
   2.120 -
   2.121 -		[Test()]
   2.122 -		public void TestAddingOneOfUnitTypeWithTwoOfOneUnitTypeRequired()
   2.123 -		{
   2.124 -			Army army = new Army(mockRace, "Test", 1000);
   2.125 -			RequiresAtLeastNUnitsRequirement<UnitType> req = new RequiresAtLeastNUnitsRequirement<UnitType>(allowedUnitType);
   2.126 -			req.AddUnitTypeRequirement(unitType1, 2);
   2.127 -			Assert.That(req.AllowsAdding(unitType1, army), Is.EqualTo(Validation.Failed));
   2.128 -		}
   2.129 -
   2.130 -		[Test()]
   2.131 -		public void TestAddingOneUnitTypeWithOneUnitAndTwoOfOneUnitTypeRequired()
   2.132 -		{
   2.133 -			Army army = new Army(mockRace, "Test", 1000);
   2.134 -			AddUnitOfTypeToArmy(unitType1, army);
   2.135 -			RequiresAtLeastNUnitsRequirement<UnitType> req = new RequiresAtLeastNUnitsRequirement<UnitType>(allowedUnitType);
   2.136 -			req.AddUnitTypeRequirement(unitType1, 2);
   2.137 -			Assert.That(req.AllowsAdding(unitType1, army), Is.EqualTo(Validation.Passed));
   2.138 -		}
   2.139 -
   2.140 -		[Test()]
   2.141 -		public void TestAddingUnitTypeRequirementWithNoNumberDefaultsToHavingOne()
   2.142 -		{
   2.143 -			Army army = new Army(mockRace, "Test", 1000);
   2.144 -			RequiresAtLeastNUnitsRequirement<UnitType> req = new RequiresAtLeastNUnitsRequirement<UnitType>(allowedUnitType);
   2.145 -			req.AddUnitTypeRequirement(unitType1);
   2.146 -			Assert.That(req.AllowsAdding(unitType1, army), Is.EqualTo(Validation.Passed));
   2.147 -		}
   2.148 -
   2.149 -		[Test()]
   2.150 -		public void TestValidityOfArmyWithNoUnitsAndOneUnitTypeRequired()
   2.151 -		{
   2.152 -			Army army = new Army(mockRace, "Test", 1000);
   2.153 -			RequiresAtLeastNUnitsRequirement<UnitType> req = new RequiresAtLeastNUnitsRequirement<UnitType>(allowedUnitType, unitType1);
   2.154 -			Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Failed));
   2.155 -		}
   2.156 -
   2.157 -		[Test()]
   2.158 -		public void TestValidityOfArmyWithOneUnitAndOneUnitTypeRequired()
   2.159 -		{
   2.160 -			Army army = new Army(mockRace, "Test", 1000);
   2.161 -			AddUnitOfTypeToArmy(unitType1, army);
   2.162 -			RequiresAtLeastNUnitsRequirement<UnitType> req = new RequiresAtLeastNUnitsRequirement<UnitType>(allowedUnitType, unitType1);
   2.163 -			Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Passed));
   2.164 -		}
   2.165 -
   2.166 -		[Test]
   2.167 -		public void TestAddingMinNumberUnitTypePassesRequirement()
   2.168 -		{
   2.169 -			Army army = new Army(mockRace, "Test", 1000);
   2.170 -			RequiresAtLeastNUnitsRequirement<UnitType> req = new RequiresAtLeastNUnitsRequirement<UnitType>(allowedUnitType);
   2.171 -			req.AddUnitTypeRequirement(unitType1, 2);
   2.172 -			Assert.That(req.AllowsAdding(unitType1, army), Is.EqualTo(Validation.Failed));
   2.173 -			AddUnitOfTypeToArmy(unitType1, army);
   2.174 -			Assert.That(req.AllowsAdding(unitType1, army), Is.EqualTo(Validation.Passed));
   2.175 -		}
   2.176 -
   2.177 -		[Test]
   2.178 -		public void TestValidationMessageIsBlankForPass()
   2.179 -		{
   2.180 -			Army army = new Army(mockRace, "Test", 1000);
   2.181 -			AddUnitOfTypeToArmy(unitType1, army);
   2.182 -			RequiresAtLeastNUnitsRequirement<UnitType> req = new RequiresAtLeastNUnitsRequirement<UnitType>(allowedUnitType, unitType1);
   2.183 -			Assert.That(req.GetValidationMessage(army), Is.Empty);
   2.184 -		}
   2.185 -
   2.186 -		[Test]
   2.187 -		public void TestValidationMessageIsCorrectForFailWithOneUnitRequired()
   2.188 -		{
   2.189 -			Army army = new Army(mockRace, "Test", 1000);
   2.190 -			RequiresAtLeastNUnitsRequirement<UnitType> req = new RequiresAtLeastNUnitsRequirement<UnitType>(allowedUnitType, unitType1);
   2.191 -			Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 1 × " + unitType1.Name + " (have 0)."));
   2.192 -		}
   2.193 -
   2.194 -		[Test]
   2.195 -		public void TestValidationMessageIsCorrectForFailWithTwoOfOneUnitRequired()
   2.196 -		{
   2.197 -			Army army = new Army(mockRace, "Test", 1000);
   2.198 -			RequiresAtLeastNUnitsRequirement<UnitType> req = new RequiresAtLeastNUnitsRequirement<UnitType>(allowedUnitType);
   2.199 -			req.AddUnitTypeRequirement(unitType1, 2);
   2.200 -			Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 2 × " + unitType1.Name + " (have 0)."));
   2.201 -		}
   2.202 -
   2.203 -		[Test]
   2.204 -		public void TestValidationMessageIsCorrectForFailWithTwoUnitsRequired()
   2.205 -		{
   2.206 -			Army army = new Army(mockRace, "Test", 1000);
   2.207 -			RequiresAtLeastNUnitsRequirement<UnitType> req = new RequiresAtLeastNUnitsRequirement<UnitType>(allowedUnitType);
   2.208 -			req.AddUnitTypeRequirement(unitType1);
   2.209 -			req.AddUnitTypeRequirement(unitType2);
   2.210 -			Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 1 × " + unitType1.Name + " (have 0); 1 × " + unitType2.Name + " (have 0)."));
   2.211 -		}
   2.212 -
   2.213 -		[Test]
   2.214 -		public void TestValidationMessageIsCorrectForFailWithTwoUnitsRequiredWithOneUnit()
   2.215 -		{
   2.216 -			Army army = new Army(mockRace, "Test", 1000);
   2.217 -			AddUnitOfTypeToArmy(unitType1, army);
   2.218 -			RequiresAtLeastNUnitsRequirement<UnitType> req = new RequiresAtLeastNUnitsRequirement<UnitType>(allowedUnitType);
   2.219 -			req.AddUnitTypeRequirement(unitType1);
   2.220 -			req.AddUnitTypeRequirement(unitType2);
   2.221 -			Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " (have 0)."));
   2.222 -		}
   2.223 -
   2.224 -		[Test]
   2.225 -		public void TestValidationMessageIsCorrectForFailWithTwoUnitsRequiredWithOtherUnit()
   2.226 -		{
   2.227 -			Army army = new Army(mockRace, "Test", 1000);
   2.228 -			AddUnitOfTypeToArmy(unitType2, army);
   2.229 -			RequiresAtLeastNUnitsRequirement<UnitType> req = new RequiresAtLeastNUnitsRequirement<UnitType>(allowedUnitType);
   2.230 -			req.AddUnitTypeRequirement(unitType1);
   2.231 -			req.AddUnitTypeRequirement(unitType2);
   2.232 -			Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 1 × " + unitType1.Name + " (have 0)."));
   2.233 -		}
   2.234 -
   2.235 -		[Test]
   2.236 -		public void TestAllowsAddingMessageIsBlankForPass()
   2.237 -		{
   2.238 -			Army army = new Army(mockRace, "Test", 1000);
   2.239 -			AddUnitOfTypeToArmy(unitType1, army);
   2.240 -			RequiresAtLeastNUnitsRequirement<UnitType> req = new RequiresAtLeastNUnitsRequirement<UnitType>(allowedUnitType, unitType1);
   2.241 -			Assert.That(req.GetAllowsAddingMessage(unitType1, army), Is.Empty);
   2.242 -		}
   2.243 -
   2.244 -		[Test]
   2.245 -		public void TestAllowsAddingMessageIsCorrectForFailWithTwoOfOneUnitRequired()
   2.246 -		{
   2.247 -			Army army = new Army(mockRace, "Test", 1000);
   2.248 -			RequiresAtLeastNUnitsRequirement<UnitType> req = new RequiresAtLeastNUnitsRequirement<UnitType>(allowedUnitType);
   2.249 -			req.AddUnitTypeRequirement(unitType1, 2);
   2.250 -			Assert.That(req.GetAllowsAddingMessage(unitType1, army), Is.EqualTo("Army must contain: 2 × " + unitType1.Name + " (would have 1)."));
   2.251 -		}
   2.252 -
   2.253 -		[Test]
   2.254 -		public void TestAllowsAddingMessageIsCorrectForFailWithTwoUnitsRequired()
   2.255 -		{
   2.256 -			Army army = new Army(mockRace, "Test", 1000);
   2.257 -			RequiresAtLeastNUnitsRequirement<UnitType> req = new RequiresAtLeastNUnitsRequirement<UnitType>(allowedUnitType);
   2.258 -			req.AddUnitTypeRequirement(unitType1);
   2.259 -			req.AddUnitTypeRequirement(unitType2);
   2.260 -			Assert.That(req.GetAllowsAddingMessage(unitType1, army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " (would have 0)."));
   2.261 -		}
   2.262 -
   2.263 -		[Test]
   2.264 -		public void TestAllowsAddingMessageIsCorrectForFailWithTwoUnitsRequiredOtherUnit()
   2.265 -		{
   2.266 -			Army army = new Army(mockRace, "Test", 1000);
   2.267 -			RequiresAtLeastNUnitsRequirement<UnitType> req = new RequiresAtLeastNUnitsRequirement<UnitType>(allowedUnitType);
   2.268 -			req.AddUnitTypeRequirement(unitType1);
   2.269 -			req.AddUnitTypeRequirement(unitType2);
   2.270 -			Assert.That(req.GetAllowsAddingMessage(unitType2, army), Is.EqualTo("Army must contain: 1 × " + unitType1.Name + " (would have 0)."));
   2.271 -		}
   2.272 -
   2.273 -		[Test]
   2.274 -		public void TestAllowsAddingMessageIsCorrectForFailWithTwoUnitsRequiredWithOneUnit()
   2.275 -		{
   2.276 -			Army army = new Army(mockRace, "Test", 1000);
   2.277 -			AddUnitOfTypeToArmy(unitType1, army);
   2.278 -			RequiresAtLeastNUnitsRequirement<UnitType> req = new RequiresAtLeastNUnitsRequirement<UnitType>(allowedUnitType);
   2.279 -			req.AddUnitTypeRequirement(unitType1);
   2.280 -			req.AddUnitTypeRequirement(unitType2);
   2.281 -			Assert.That(req.GetAllowsAddingMessage(unitType1, army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " (would have 0)."));
   2.282 -		}
   2.283 -
   2.284 -		[Test]
   2.285 -		public void TestAllowsAddingMessageIsCorrectForFailWithTwoUnitsRequiredWithOtherUnit()
   2.286 -		{
   2.287 -			Army army = new Army(mockRace, "Test", 1000);
   2.288 -			AddUnitOfTypeToArmy(unitType2, army);
   2.289 -			RequiresAtLeastNUnitsRequirement<UnitType> req = new RequiresAtLeastNUnitsRequirement<UnitType>(allowedUnitType);
   2.290 -			req.AddUnitTypeRequirement(unitType1);
   2.291 -			req.AddUnitTypeRequirement(unitType2);
   2.292 -			Assert.That(req.GetAllowsAddingMessage(unitType2, army), Is.EqualTo("Army must contain: 1 × " + unitType1.Name + " (would have 0)."));
   2.293 -		}
   2.294 -
   2.295 -		private static void AddUnitOfTypeToArmy(UnitType unitType, Army army)
   2.296 -		{
   2.297 -			army.AddUnit(CreateUnitOfType(unitType, army));
   2.298 -		}
   2.299 -
   2.300 -		private static Unit CreateUnitOfType(UnitType unitType, Army army)
   2.301 -		{
   2.302 -			return new Unit(unitType, army.GetCategory(unitType.MainCategory));
   2.303 -		}
   2.304 -
   2.305 -		public override RequiresAtLeastNUnitsRequirement<UnitType> GetObject()
   2.306 -		{
   2.307 -			RequiresAtLeastNUnitsRequirement<UnitType> req = new RequiresAtLeastNUnitsRequirement<UnitType>(allowedUnitType);
   2.308 -			req.AddUnitTypeRequirement(unitType1, 2);
   2.309 -			return req;
   2.310 -		}
   2.311 -
   2.312 -		public override RequiresAtLeastNUnitsRequirement<UnitType> GetSameObject()
   2.313 -		{
   2.314 -			RequiresAtLeastNUnitsRequirement<UnitType> req = new RequiresAtLeastNUnitsRequirement<UnitType>(allowedUnitType);
   2.315 -			req.AddUnitTypeRequirement(unitType1, 2);
   2.316 -			return req;
   2.317 -		}
   2.318 -
   2.319 -		public override RequiresAtLeastNUnitsRequirement<UnitType> GetDifferentObject()
   2.320 -		{
   2.321 -			RequiresAtLeastNUnitsRequirement<UnitType> req = new RequiresAtLeastNUnitsRequirement<UnitType>(allowedUnitType);
   2.322 -			DummyWarFoundryFactory factory = new DummyWarFoundryFactory();
   2.323 -			GameSystem gameSystem = new GameSystem("system", "system", factory);
   2.324 -			Race race = new Race("race", "race", gameSystem, factory);
   2.325 -			req.AddUnitTypeRequirement(new UnitType("id2", "Type 2", race), 2);
   2.326 -			return req;
   2.327 -		}
   2.328 -	}
   2.329 -}
   2.330 -
     3.1 --- a/API/Objects/Requirement/RequiresNUnitsForMObjectsRequirementTest.cs	Sun Feb 26 15:38:13 2012 +0000
     3.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.3 @@ -1,754 +0,0 @@
     3.4 -// This file (UnitRequiresNUnitsForMObjectsRequirement.cs) is a part of the IBBoard.WarFoundry.API.Tests project and is copyright 2011 IBBoard
     3.5 -// 
     3.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.
     3.7 -using System;
     3.8 -using NUnit.Framework;
     3.9 -using IBBoard.WarFoundry.API.Objects.Mock;
    3.10 -using NUnit.Framework.SyntaxHelpers;
    3.11 -using System.Reflection;
    3.12 -using IBBoard.NUnit;
    3.13 -using IBBoard.WarFoundry.API.Factories;
    3.14 -
    3.15 -namespace IBBoard.WarFoundry.API.Objects.Requirement
    3.16 -{
    3.17 -	public abstract class RequiresNUnitsForMObjectsRequirementTest : AbstractEqualityTest<RequiresNUnitsForMObjectsRequirement<UnitType>>
    3.18 -	{
    3.19 -		private MockRace mockRace;
    3.20 -		private UnitType unitType1;
    3.21 -		private UnitType unitType2;
    3.22 -		private UnitType unitType3;
    3.23 -		private UnitType unitType4;
    3.24 -
    3.25 -		[TestFixtureSetUp()]
    3.26 -		public void SetupRace()
    3.27 -		{
    3.28 -			mockRace = MockRace.GetMockRace();
    3.29 -			unitType1 = new MockUnitType("type1", "Unit Type 1");
    3.30 -			mockRace.AddUnitType(unitType1);
    3.31 -			unitType2 = new MockUnitType("type2", "Unit Type 2");
    3.32 -			mockRace.AddUnitType(unitType2);
    3.33 -			unitType3 = new MockUnitType("type3", "Unit Type 3");
    3.34 -			mockRace.AddUnitType(unitType3);
    3.35 -			unitType4 = new MockUnitType("type4", "Unit Type 4");
    3.36 -			mockRace.AddUnitType(unitType4);
    3.37 -		}
    3.38 -
    3.39 -		[Test()]
    3.40 -		public void TestAddingUnrelatedUnitWithNoUnitsAndOneUnitTypeRequiredIsNA()
    3.41 -		{
    3.42 -			Army army = new Army(mockRace, "Test", 1000);
    3.43 -			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1, unitType2);
    3.44 -			Unit unit = CreateUnitOfType(unitType3, army);
    3.45 -			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.NotApplicable));
    3.46 -			Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.Empty);
    3.47 -		}
    3.48 -
    3.49 -		[Test()]
    3.50 -		public void TestAddingOneUnitWithOneUnitTypeRequiredAndOneUnitOfTypePasses()
    3.51 -		{
    3.52 -			Army army = new Army(mockRace, "Test", 1000);
    3.53 -			AddUnitOfTypeToArmy(unitType2, army);
    3.54 -			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1, unitType2);
    3.55 -			Unit unit = CreateUnitOfType(unitType1, army);
    3.56 -			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Passed));
    3.57 -			Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.Empty);
    3.58 -		}
    3.59 -
    3.60 -		[Test()]
    3.61 -		public void TestAddingOneUnitWithOneUnitTypeRequiredAndNoUnitOfTypeFails()
    3.62 -		{
    3.63 -			Army army = new Army(mockRace, "Test", 1000);
    3.64 -			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1, unitType2);
    3.65 -			Unit unit = CreateUnitOfType(unitType1, army);
    3.66 -			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed));
    3.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)."));
    3.68 -		}
    3.69 -
    3.70 -		[Test()]
    3.71 -		public void TestAddingOneUnitWithTwoDifferentUnitTypesRequiredAndNoUnitOfOneTypeFails()
    3.72 -		{
    3.73 -			Army army = new Army(mockRace, "Test", 1000);
    3.74 -			AddUnitOfTypeToArmy(unitType2, army);
    3.75 -			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1);
    3.76 -			req.AddUnitTypeRequirement(unitType2);
    3.77 -			req.AddUnitTypeRequirement(unitType3);
    3.78 -			Unit unit = CreateUnitOfType(unitType1, army);
    3.79 -			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed));
    3.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)."));
    3.81 -		}
    3.82 -
    3.83 -		[Test()]
    3.84 -		public void TestAddingTwoUnitsWithOneUnitTypeRequiredAndOneUnitOfTypeFails()
    3.85 -		{
    3.86 -			Army army = new Army(mockRace, "Test", 1000);
    3.87 -			AddUnitOfTypeToArmy(unitType2, army);
    3.88 -			AddUnitOfTypeToArmy(unitType1, army);
    3.89 -			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1, unitType2);
    3.90 -			Unit unit = CreateUnitOfType(unitType1, army);
    3.91 -			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed));
    3.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)."));
    3.93 -		}
    3.94 -
    3.95 -		[Test()]
    3.96 -		public void TestAddingTwoUnitsWithTwoOfUnitTypeAllowedForOneUnitTypeRequiredAndOneUnitOfTypePasses()
    3.97 -		{
    3.98 -			Army army = new Army(mockRace, "Test", 1000);
    3.99 -			AddUnitOfTypeToArmy(unitType2, army);
   3.100 -			AddUnitOfTypeToArmy(unitType1, army);
   3.101 -			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1);
   3.102 -			req.AddUnitTypeRequirement(unitType2, 1, 2);
   3.103 -			Unit unit = CreateUnitOfType(unitType1, army);
   3.104 -			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Passed));
   3.105 -			Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.Empty);
   3.106 -		}
   3.107 -
   3.108 -		[Test()]
   3.109 -		public void TestAddingTwoUnitsWithTwoAllowedAndOneAllowedForDifferentTypesFails()
   3.110 -		{
   3.111 -			Army army = new Army(mockRace, "Test", 1000);
   3.112 -			AddUnitOfTypeToArmy(unitType2, army);
   3.113 -			AddUnitOfTypeToArmy(unitType3, army);
   3.114 -			AddUnitOfTypeToArmy(unitType1, army);
   3.115 -			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1);
   3.116 -			req.AddUnitTypeRequirement(unitType2, 1, 2);
   3.117 -			req.AddUnitTypeRequirement(unitType3, 1, 1);
   3.118 -			Unit unit = CreateUnitOfType(unitType1, army);
   3.119 -			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed));
   3.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)."));
   3.121 -		}
   3.122 -
   3.123 -		[Test()]
   3.124 -		public void TestAddingSecondUnitsWithOneAllowedForTwoTypesFails()
   3.125 -		{
   3.126 -			Army army = new Army(mockRace, "Test", 1000);
   3.127 -			AddUnitOfTypeToArmy(unitType2, army);
   3.128 -			AddUnitOfTypeToArmy(unitType3, army);
   3.129 -			AddUnitOfTypeToArmy(unitType1, army);
   3.130 -			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1);
   3.131 -			req.AddUnitTypeRequirement(unitType2, 1, 1);
   3.132 -			req.AddUnitTypeRequirement(unitType3, 1, 1);
   3.133 -			Unit unit = CreateUnitOfType(unitType1, army);
   3.134 -			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed));
   3.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)."));
   3.136 -		}
   3.137 -
   3.138 -		[Test()]
   3.139 -		public void TestAddingSecondUnitsWithOneAllowedForTwoTypesFails_ShorthandMethod()
   3.140 -		{
   3.141 -			Army army = new Army(mockRace, "Test", 1000);
   3.142 -			AddUnitOfTypeToArmy(unitType2, army);
   3.143 -			AddUnitOfTypeToArmy(unitType3, army);
   3.144 -			AddUnitOfTypeToArmy(unitType1, army);
   3.145 -			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1, unitType2, unitType3);
   3.146 -			Unit unit = CreateUnitOfType(unitType1, army);
   3.147 -			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed));
   3.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)."));
   3.149 -		}
   3.150 -
   3.151 -		[Test()]
   3.152 -		public void TestAddingThreeUnitsWithTwoOfUnitTypeAllowedForOneUnitTypeRequiredAndOneUnitOfTypeFails()
   3.153 -		{
   3.154 -			Army army = new Army(mockRace, "Test", 1000);
   3.155 -			AddUnitOfTypeToArmy(unitType2, army);
   3.156 -			AddUnitOfTypeToArmy(unitType1, army);
   3.157 -			AddUnitOfTypeToArmy(unitType1, army);
   3.158 -			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1);
   3.159 -			req.AddUnitTypeRequirement(unitType2, 1, 2);
   3.160 -			Unit unit = CreateUnitOfType(unitType1, army);
   3.161 -			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed));
   3.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)."));
   3.163 -		}
   3.164 -
   3.165 -		[Test()]
   3.166 -		public void TestAddingOneUnitWithThreeOfUnitTypeAllowedForTwoOfUnitTypeRequiredAndOneUnitOfTypeFails()
   3.167 -		{
   3.168 -			Army army = new Army(mockRace, "Test", 1000);
   3.169 -			AddUnitOfTypeToArmy(unitType2, army);
   3.170 -			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1);
   3.171 -			req.AddUnitTypeRequirement(unitType2, 2, 3);
   3.172 -			Unit unit = CreateUnitOfType(unitType1, army);
   3.173 -			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed));
   3.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)."));
   3.175 -		}
   3.176 -
   3.177 -		[Test()]
   3.178 -		public void TestAddingSecondUnitWithThreeOfUnitTypeAllowedForTwoOfUnitTypeRequiredAndOneUnitOfTypeFails()
   3.179 -		{
   3.180 -			Army army = new Army(mockRace, "Test", 1000);
   3.181 -			AddUnitOfTypeToArmy(unitType2, army);
   3.182 -			AddUnitOfTypeToArmy(unitType1, army);
   3.183 -			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1);
   3.184 -			req.AddUnitTypeRequirement(unitType2, 2, 3);
   3.185 -			Unit unit = CreateUnitOfType(unitType1, army);
   3.186 -			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed));
   3.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)."));
   3.188 -		}
   3.189 -
   3.190 -		[Test()]
   3.191 -		public void TestAddingFourthUnitWithThreeOfUnitTypeAllowedForTwoOfUnitTypeRequiredAndThreeUnitsOfTypeFails()
   3.192 -		{
   3.193 -			Army army = new Army(mockRace, "Test", 1000);
   3.194 -			AddUnitsOfTypeToArmy(3, unitType2, army);
   3.195 -			AddUnitsOfTypeToArmy(3, unitType1, army);
   3.196 -			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1);
   3.197 -			req.AddUnitTypeRequirement(unitType2, 2, 3);
   3.198 -			Unit unit = CreateUnitOfType(unitType1, army);
   3.199 -			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed));
   3.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)."));
   3.201 -		}
   3.202 -
   3.203 -		[Test()]
   3.204 -		public void TestAddingUnrelatedUnitWithNoUnitsAndTwoCombinedUnitTypesRequiredIsNA()
   3.205 -		{
   3.206 -			Army army = new Army(mockRace, "Test", 1000);
   3.207 -			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1);
   3.208 -			req.AddUnitTypeRequirement(unitType2, unitType3);
   3.209 -			Unit unit = CreateUnitOfType(unitType4, army);
   3.210 -			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.NotApplicable));
   3.211 -			Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.Empty);
   3.212 -		}
   3.213 -
   3.214 -		[Test()]
   3.215 -		public void TestAddingOneUnitWithTwoUnitTypeComboRequiredAndUnitOfOneTypePasses()
   3.216 -		{
   3.217 -			Army army = new Army(mockRace, "Test", 1000);
   3.218 -			AddUnitOfTypeToArmy(unitType2, army);
   3.219 -			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1);
   3.220 -			req.AddUnitTypeRequirement(unitType2, unitType3);
   3.221 -			Unit unit = CreateUnitOfType(unitType1, army);
   3.222 -			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Passed));
   3.223 -			Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.Empty);
   3.224 -		}
   3.225 -
   3.226 -		[Test()]
   3.227 -		public void TestAddingOneUnitWithTwoUnitTypeComboRequiredAndUnitOfOtherTypePasses()
   3.228 -		{
   3.229 -			Army army = new Army(mockRace, "Test", 1000);
   3.230 -			AddUnitOfTypeToArmy(unitType3, army);
   3.231 -			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1);
   3.232 -			req.AddUnitTypeRequirement(unitType2, unitType3);
   3.233 -			Unit unit = CreateUnitOfType(unitType1, army);
   3.234 -			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Passed));
   3.235 -			Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.Empty);
   3.236 -		}
   3.237 -
   3.238 -		[Test()]
   3.239 -		public void TestAddingTwoUnitsWithTwoUnitTypeComboRequiredAndOneUnitOfBothTypesPasses()
   3.240 -		{
   3.241 -			Army army = new Army(mockRace, "Test", 1000);
   3.242 -			AddUnitOfTypeToArmy(unitType3, army);
   3.243 -			AddUnitOfTypeToArmy(unitType2, army);
   3.244 -			AddUnitOfTypeToArmy(unitType1, army);
   3.245 -			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1);
   3.246 -			req.AddUnitTypeRequirement(unitType2, unitType3);
   3.247 -			Unit unit = CreateUnitOfType(unitType1, army);
   3.248 -			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Passed));
   3.249 -			Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.Empty);
   3.250 -		}
   3.251 -
   3.252 -		[Test()]
   3.253 -		public void TestAddingTwoUnitsWithTwoUnitTypeComboRequiredAndTwoUnitsOfOneTypePasses()
   3.254 -		{
   3.255 -			Army army = new Army(mockRace, "Test", 1000);
   3.256 -			AddUnitOfTypeToArmy(unitType3, army);
   3.257 -			AddUnitOfTypeToArmy(unitType3, army);
   3.258 -			AddUnitOfTypeToArmy(unitType1, army);
   3.259 -			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1);
   3.260 -			req.AddUnitTypeRequirement(unitType2, unitType3);
   3.261 -			Unit unit = CreateUnitOfType(unitType1, army);
   3.262 -			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Passed));
   3.263 -			Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.Empty);
   3.264 -		}
   3.265 -
   3.266 -		[Test()]
   3.267 -		public void TestAddingTwoUnitsWithTwoUnitTypeComboRequiredAndTwoUnitsOfOtherTypePasses()
   3.268 -		{
   3.269 -			Army army = new Army(mockRace, "Test", 1000);
   3.270 -			AddUnitOfTypeToArmy(unitType2, army);
   3.271 -			AddUnitOfTypeToArmy(unitType2, army);
   3.272 -			AddUnitOfTypeToArmy(unitType1, army);
   3.273 -			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1);
   3.274 -			req.AddUnitTypeRequirement(unitType2, unitType3);
   3.275 -			Unit unit = CreateUnitOfType(unitType1, army);
   3.276 -			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Passed));
   3.277 -			Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.Empty);
   3.278 -		}
   3.279 -
   3.280 -		[Test()]
   3.281 -		public void TestAddingThreeUnitsWithTwoUnitTypeComboRequiredAndOneUnitOfBothTypesFails()
   3.282 -		{
   3.283 -			Army army = new Army(mockRace, "Test", 1000);
   3.284 -			AddUnitOfTypeToArmy(unitType3, army);
   3.285 -			AddUnitOfTypeToArmy(unitType2, army);
   3.286 -			AddUnitOfTypeToArmy(unitType1, army);
   3.287 -			AddUnitOfTypeToArmy(unitType1, army);
   3.288 -			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1);
   3.289 -			req.AddUnitTypeRequirement(unitType2, unitType3);
   3.290 -			Unit unit = CreateUnitOfType(unitType1, army);
   3.291 -			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed));
   3.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)."));
   3.293 -		}
   3.294 -
   3.295 -		[Test()]
   3.296 -		public void TestAddingThreeUnitsWithTwoUnitTypeComboRequiredAndTwoUnitsOfOneTypeFails()
   3.297 -		{
   3.298 -			Army army = new Army(mockRace, "Test", 1000);
   3.299 -			AddUnitOfTypeToArmy(unitType3, army);
   3.300 -			AddUnitOfTypeToArmy(unitType3, army);
   3.301 -			AddUnitOfTypeToArmy(unitType1, army);
   3.302 -			AddUnitOfTypeToArmy(unitType1, army);
   3.303 -			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1);
   3.304 -			req.AddUnitTypeRequirement(unitType2, unitType3);
   3.305 -			Unit unit = CreateUnitOfType(unitType1, army);
   3.306 -			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed));
   3.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)."));
   3.308 -		}
   3.309 -
   3.310 -		[Test()]
   3.311 -		public void TestAddingThreeUnitsWithTwoUnitTypeComboRequiredAndTwoUnitsOfOtherTypeFails()
   3.312 -		{
   3.313 -			Army army = new Army(mockRace, "Test", 1000);
   3.314 -			AddUnitOfTypeToArmy(unitType2, army);
   3.315 -			AddUnitOfTypeToArmy(unitType2, army);
   3.316 -			AddUnitOfTypeToArmy(unitType1, army);
   3.317 -			AddUnitOfTypeToArmy(unitType1, army);
   3.318 -			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1);
   3.319 -			req.AddUnitTypeRequirement(unitType2, unitType3);
   3.320 -			Unit unit = CreateUnitOfType(unitType1, army);
   3.321 -			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed));
   3.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)."));
   3.323 -		}
   3.324 -
   3.325 -		[Test()]
   3.326 -		public void TestAddingUnrelatedUnitWithNoUnitsAndThreeForEachTwoCombinedUnitTypesRequiredIsNA()
   3.327 -		{
   3.328 -			Army army = new Army(mockRace, "Test", 1000);
   3.329 -			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1);
   3.330 -			req.AddUnitTypeRequirement(3, unitType2, unitType3);
   3.331 -			Unit unit = CreateUnitOfType(unitType4, army);
   3.332 -			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.NotApplicable));
   3.333 -			Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.Empty);
   3.334 -		}
   3.335 -
   3.336 -		[Test()]
   3.337 -		public void TestAddingThirdUnitWithThreeForEachTwoUnitTypeComboRequiredAndUnitOfOneTypePasses()
   3.338 -		{
   3.339 -			Army army = new Army(mockRace, "Test", 1000);
   3.340 -			AddUnitOfTypeToArmy(unitType2, army);
   3.341 -			AddUnitsOfTypeToArmy(2, unitType1, army);
   3.342 -			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1);
   3.343 -			req.AddUnitTypeRequirement(3, unitType2, unitType3);
   3.344 -			Unit unit = CreateUnitOfType(unitType1, army);
   3.345 -			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Passed));
   3.346 -			Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.Empty);
   3.347 -		}
   3.348 -
   3.349 -		[Test()]
   3.350 -		public void TestAddingThirdUnitWithThreeForEachTwoUnitTypeComboRequiredAndUnitOfOtherTypePasses()
   3.351 -		{
   3.352 -			Army army = new Army(mockRace, "Test", 1000);
   3.353 -			AddUnitOfTypeToArmy(unitType3, army);
   3.354 -			AddUnitsOfTypeToArmy(2, unitType1, army);
   3.355 -			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1);
   3.356 -			req.AddUnitTypeRequirement(3, unitType2, unitType3);
   3.357 -			Unit unit = CreateUnitOfType(unitType1, army);
   3.358 -			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Passed));
   3.359 -			Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.Empty);
   3.360 -		}
   3.361 -
   3.362 -		[Test()]
   3.363 -		public void TestAddingSixthUnitWithThreeForEachTwoUnitTypeComboRequiredAndOneUnitOfBothTypesPasses()
   3.364 -		{
   3.365 -			Army army = new Army(mockRace, "Test", 1000);
   3.366 -			AddUnitOfTypeToArmy(unitType3, army);
   3.367 -			AddUnitOfTypeToArmy(unitType2, army);
   3.368 -			AddUnitsOfTypeToArmy(5, unitType1, army);
   3.369 -			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1);
   3.370 -			req.AddUnitTypeRequirement(3, unitType2, unitType3);
   3.371 -			Unit unit = CreateUnitOfType(unitType1, army);
   3.372 -			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Passed));
   3.373 -			Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.Empty);
   3.374 -		}
   3.375 -
   3.376 -		[Test()]
   3.377 -		public void TestAddingSixthUnitWithThreeForEachTwoUnitTypeComboRequiredAndTwoUnitsOfOneTypePasses()
   3.378 -		{
   3.379 -			Army army = new Army(mockRace, "Test", 1000);
   3.380 -			AddUnitsOfTypeToArmy(2, unitType3, army);
   3.381 -			AddUnitsOfTypeToArmy(5, unitType1, army);
   3.382 -			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1);
   3.383 -			req.AddUnitTypeRequirement(3, unitType2, unitType3);
   3.384 -			Unit unit = CreateUnitOfType(unitType1, army);
   3.385 -			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Passed));
   3.386 -			Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.Empty);
   3.387 -		}
   3.388 -
   3.389 -		[Test()]
   3.390 -		public void TestAddingSixthUnitWithThreeForEachTwoUnitTypeComboRequiredAndTwoUnitsOfOtherTypePasses()
   3.391 -		{
   3.392 -			Army army = new Army(mockRace, "Test", 1000);
   3.393 -			AddUnitsOfTypeToArmy(2, unitType2, army);
   3.394 -			AddUnitsOfTypeToArmy(5, unitType1, army);
   3.395 -			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1);
   3.396 -			req.AddUnitTypeRequirement(3, unitType2, unitType3);
   3.397 -			Unit unit = CreateUnitOfType(unitType1, army);
   3.398 -			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Passed));
   3.399 -			Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.Empty);
   3.400 -		}
   3.401 -
   3.402 -		[Test()]
   3.403 -		public void TestAddingSevenUnitsWithThreeForEachTwoUnitTypeComboRequiredAndOneUnitOfBothTypesFails()
   3.404 -		{
   3.405 -			Army army = new Army(mockRace, "Test", 1000);
   3.406 -			AddUnitOfTypeToArmy(unitType3, army);
   3.407 -			AddUnitOfTypeToArmy(unitType2, army);
   3.408 -			AddUnitsOfTypeToArmy(6, unitType1, army);
   3.409 -			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1);
   3.410 -			req.AddUnitTypeRequirement(3, unitType2, unitType3);
   3.411 -			Unit unit = CreateUnitOfType(unitType1, army);
   3.412 -			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed));
   3.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)."));
   3.414 -		}
   3.415 -
   3.416 -		[Test()]
   3.417 -		public void TestAddingSevenUnitsWithThreeForEachTwoUnitTypeComboRequiredAndTwoUnitsOfOneTypeFails()
   3.418 -		{
   3.419 -			Army army = new Army(mockRace, "Test", 1000);
   3.420 -			AddUnitsOfTypeToArmy(2, unitType3, army);
   3.421 -			AddUnitsOfTypeToArmy(6, unitType1, army);
   3.422 -			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1);
   3.423 -			req.AddUnitTypeRequirement(3, unitType2, unitType3);
   3.424 -			Unit unit = CreateUnitOfType(unitType1, army);
   3.425 -			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed));
   3.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)."));
   3.427 -		}
   3.428 -
   3.429 -		[Test()]
   3.430 -		public void TestAddingSevenUnitsWithThreeForEachTwoUnitTypeComboRequiredAndTwoUnitsOfOtherTypeFails()
   3.431 -		{
   3.432 -			Army army = new Army(mockRace, "Test", 1000);
   3.433 -			AddUnitsOfTypeToArmy(2, unitType2, army);
   3.434 -			AddUnitsOfTypeToArmy(6, unitType1, army);
   3.435 -			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1);
   3.436 -			req.AddUnitTypeRequirement(3, unitType2, unitType3);
   3.437 -			Unit unit = CreateUnitOfType(unitType1, army);
   3.438 -			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed));
   3.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)."));
   3.440 -		}
   3.441 -
   3.442 -		[Test()]
   3.443 -		public void TestValidatingArmyWithNoUnitsAndOneUnitTypeRequiredIsNA()
   3.444 -		{
   3.445 -			Army army = new Army(mockRace, "Test", 1000);
   3.446 -			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1, unitType2);
   3.447 -			Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.NotApplicable));
   3.448 -			Assert.That(req.GetValidationMessage(army), Is.Empty);
   3.449 -		}
   3.450 -
   3.451 -		[Test()]
   3.452 -		public void TestValidatingArmyWithOneUnitTypeRequiredAndOneUnitOfTypePasses()
   3.453 -		{
   3.454 -			Army army = new Army(mockRace, "Test", 1000);
   3.455 -			AddUnitOfTypeToArmy(unitType2, army);
   3.456 -			AddUnitOfTypeToArmy(unitType1, army);
   3.457 -			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1, unitType2);
   3.458 -			Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Passed));
   3.459 -			Assert.That(req.GetValidationMessage(army), Is.Empty);
   3.460 -		}
   3.461 -
   3.462 -		[Test()]
   3.463 -		public void TestValidatingArmyWithOneUnitTypeRequiredAndNoUnitOfTypeFails()
   3.464 -		{
   3.465 -			Army army = new Army(mockRace, "Test", 1000);
   3.466 -			AddUnitOfTypeToArmy(unitType1, army);
   3.467 -			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1, unitType2);
   3.468 -			Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Failed));
   3.469 -			Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " for every 1 × " + unitType1.Name + " (have 0 for 1)."));
   3.470 -		}
   3.471 -
   3.472 -		[Test()]
   3.473 -		public void TestValidatingArmyWithTwoDifferentUnitTypesRequiredAndNoUnitOfOneTypeFails()
   3.474 -		{
   3.475 -			Army army = new Army(mockRace, "Test", 1000);
   3.476 -			AddUnitOfTypeToArmy(unitType2, army);
   3.477 -			AddUnitOfTypeToArmy(unitType1, army);
   3.478 -			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1);
   3.479 -			req.AddUnitTypeRequirement(unitType2);
   3.480 -			req.AddUnitTypeRequirement(unitType3);
   3.481 -			Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Failed));
   3.482 -			Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 1 × " + unitType3.Name + " for every 1 × " + unitType1.Name + " (have 0 for 1)."));
   3.483 -		}
   3.484 -
   3.485 -		[Test()]
   3.486 -		public void TestValidatingArmyWithTwoUnitsAndOneUnitTypeRequiredAndOneUnitOfTypeFails()
   3.487 -		{
   3.488 -			Army army = new Army(mockRace, "Test", 1000);
   3.489 -			AddUnitOfTypeToArmy(unitType2, army);
   3.490 -			AddUnitOfTypeToArmy(unitType1, army);
   3.491 -			AddUnitOfTypeToArmy(unitType1, army);
   3.492 -			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1, unitType2);
   3.493 -			Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Failed));
   3.494 -			Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " for every 1 × " + unitType1.Name + " (have 1 for 2)."));
   3.495 -		}
   3.496 -
   3.497 -		[Test()]
   3.498 -		public void TestValidatingArmyWithTwoUnitsAndTwoOfUnitTypeAllowedForOneUnitTypeRequiredAndOneUnitOfTypePasses()
   3.499 -		{
   3.500 -			Army army = new Army(mockRace, "Test", 1000);
   3.501 -			AddUnitOfTypeToArmy(unitType2, army);
   3.502 -			AddUnitOfTypeToArmy(unitType1, army);
   3.503 -			AddUnitOfTypeToArmy(unitType1, army);
   3.504 -			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1);
   3.505 -			req.AddUnitTypeRequirement(unitType2, 1, 2);
   3.506 -			Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Passed));
   3.507 -			Assert.That(req.GetValidationMessage(army), Is.Empty);
   3.508 -		}
   3.509 -
   3.510 -		[Test()]
   3.511 -		public void TestValidatingArmyWithTwoUnitsWithTwoAllowedAndOneAllowedForDifferentTypesFails()
   3.512 -		{
   3.513 -			Army army = new Army(mockRace, "Test", 1000);
   3.514 -			AddUnitOfTypeToArmy(unitType2, army);
   3.515 -			AddUnitOfTypeToArmy(unitType3, army);
   3.516 -			AddUnitOfTypeToArmy(unitType1, army);
   3.517 -			AddUnitOfTypeToArmy(unitType1, army);
   3.518 -			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1);
   3.519 -			req.AddUnitTypeRequirement(unitType2, 1, 2);
   3.520 -			req.AddUnitTypeRequirement(unitType3, 1, 1);
   3.521 -			Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Failed));
   3.522 -			Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 1 × " + unitType3.Name + " for every 1 × " + unitType1.Name + " (have 1 for 2)."));
   3.523 -		}
   3.524 -
   3.525 -		[Test()]
   3.526 -		public void TestValidatingArmyWithTwoUnitsWithOneAllowedForTwoTypesFails()
   3.527 -		{
   3.528 -			Army army = new Army(mockRace, "Test", 1000);
   3.529 -			AddUnitOfTypeToArmy(unitType2, army);
   3.530 -			AddUnitOfTypeToArmy(unitType3, army);
   3.531 -			AddUnitOfTypeToArmy(unitType1, army);
   3.532 -			AddUnitOfTypeToArmy(unitType1, army);
   3.533 -			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1);
   3.534 -			req.AddUnitTypeRequirement(unitType2, 1, 1);
   3.535 -			req.AddUnitTypeRequirement(unitType3, 1, 1);
   3.536 -			Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Failed));
   3.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)."));
   3.538 -		}
   3.539 -
   3.540 -		[Test()]
   3.541 -		public void TestValidatingArmyWithTwoUnitsWithOneAllowedForTwoTypesFails_ShorthandMethod()
   3.542 -		{
   3.543 -			Army army = new Army(mockRace, "Test", 1000);
   3.544 -			AddUnitOfTypeToArmy(unitType2, army);
   3.545 -			AddUnitOfTypeToArmy(unitType3, army);
   3.546 -			AddUnitOfTypeToArmy(unitType1, army);
   3.547 -			AddUnitOfTypeToArmy(unitType1, army);
   3.548 -			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1, unitType2, unitType3);
   3.549 -			Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Failed));
   3.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)."));
   3.551 -		}
   3.552 -
   3.553 -		[Test()]
   3.554 -		public void TestValidatingArmyWithOneUnitWithThreeOfUnitTypeAllowedForTwoOfUnitTypeRequiredAndOneUnitOfTypeFails()
   3.555 -		{
   3.556 -			Army army = new Army(mockRace, "Test", 1000);
   3.557 -			AddUnitOfTypeToArmy(unitType2, army);
   3.558 -			AddUnitOfTypeToArmy(unitType1, army);
   3.559 -			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1);
   3.560 -			req.AddUnitTypeRequirement(unitType2, 2, 3);
   3.561 -			Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Failed));
   3.562 -			Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 2 × " + unitType2.Name + " for every 3 × " + unitType1.Name + " (have 1 for 1)."));
   3.563 -		}
   3.564 -
   3.565 -		[Test()]
   3.566 -		public void TestValidatingArmyWithTwoUnitsWithThreeOfUnitTypeAllowedForTwoOfUnitTypeRequiredAndOneUnitOfTypeFails()
   3.567 -		{
   3.568 -			Army army = new Army(mockRace, "Test", 1000);
   3.569 -			AddUnitOfTypeToArmy(unitType2, army);
   3.570 -			AddUnitsOfTypeToArmy(2, unitType1, army);
   3.571 -			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1);
   3.572 -			req.AddUnitTypeRequirement(unitType2, 2, 3);
   3.573 -			Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Failed));
   3.574 -			Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 2 × " + unitType2.Name + " for every 3 × " + unitType1.Name + " (have 1 for 2)."));
   3.575 -		}
   3.576 -
   3.577 -		[Test()]
   3.578 -		public void TestValidatingArmyWithFourUnitsWithThreeOfUnitTypeAllowedForTwoOfUnitTypeRequiredAndThreeUnitsOfTypeFails()
   3.579 -		{
   3.580 -			Army army = new Army(mockRace, "Test", 1000);
   3.581 -			AddUnitsOfTypeToArmy(3, unitType2, army);
   3.582 -			AddUnitsOfTypeToArmy(4, unitType1, army);
   3.583 -			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1);
   3.584 -			req.AddUnitTypeRequirement(unitType2, 2, 3);
   3.585 -			Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Failed));
   3.586 -			Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 2 × " + unitType2.Name + " for every 3 × " + unitType1.Name + " (have 3 for 4)."));
   3.587 -		}
   3.588 -
   3.589 -		[Test()]
   3.590 -		public void TestValidatingArmyWithThreeUnitsAndTwoOfUnitTypeAllowedForOneUnitTypeRequiredAndOneUnitOfTypeFails()
   3.591 -		{
   3.592 -			Army army = new Army(mockRace, "Test", 1000);
   3.593 -			AddUnitOfTypeToArmy(unitType2, army);
   3.594 -			AddUnitOfTypeToArmy(unitType1, army);
   3.595 -			AddUnitOfTypeToArmy(unitType1, army);
   3.596 -			AddUnitOfTypeToArmy(unitType1, army);
   3.597 -			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1);
   3.598 -			req.AddUnitTypeRequirement(unitType2, 1, 2);
   3.599 -			Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Failed));
   3.600 -			Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " for every 2 × " + unitType1.Name + " (have 1 for 3)."));
   3.601 -		}
   3.602 -
   3.603 -		[Test()]
   3.604 -		public void TestValidatingArmyWithNoUnitsAndThreeForEachTwoCombinedUnitTypesRequiredIsNA()
   3.605 -		{
   3.606 -			Army army = new Army(mockRace, "Test", 1000);
   3.607 -			AddUnitOfTypeToArmy(unitType4, army);
   3.608 -			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1);
   3.609 -			req.AddUnitTypeRequirement(3, unitType2, unitType3);
   3.610 -			Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.NotApplicable));
   3.611 -			Assert.That(req.GetValidationMessage(army), Is.Empty);
   3.612 -		}
   3.613 -
   3.614 -		[Test()]
   3.615 -		public void TestValidatingArmyWithThreeUnitsWithThreeForEachTwoUnitTypeComboRequiredAndUnitOfOneTypePasses()
   3.616 -		{
   3.617 -			Army army = new Army(mockRace, "Test", 1000);
   3.618 -			AddUnitOfTypeToArmy(unitType2, army);
   3.619 -			AddUnitsOfTypeToArmy(3, unitType1, army);
   3.620 -			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1);
   3.621 -			req.AddUnitTypeRequirement(3, unitType2, unitType3);
   3.622 -			Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Passed));
   3.623 -			Assert.That(req.GetValidationMessage(army), Is.Empty);
   3.624 -		}
   3.625 -
   3.626 -		[Test()]
   3.627 -		public void TestValidatingArmyWithThreeUnitsWithThreeForEachTwoUnitTypeComboRequiredAndUnitOfOtherTypePasses()
   3.628 -		{
   3.629 -			Army army = new Army(mockRace, "Test", 1000);
   3.630 -			AddUnitOfTypeToArmy(unitType3, army);
   3.631 -			AddUnitsOfTypeToArmy(3, unitType1, army);
   3.632 -			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1);
   3.633 -			req.AddUnitTypeRequirement(3, unitType2, unitType3);
   3.634 -			Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Passed));
   3.635 -			Assert.That(req.GetValidationMessage(army), Is.Empty);
   3.636 -		}
   3.637 -
   3.638 -		[Test()]
   3.639 -		public void TestValidatingArmyWithSixUnitsWithThreeForEachTwoUnitTypeComboRequiredAndOneUnitOfBothTypesPasses()
   3.640 -		{
   3.641 -			Army army = new Army(mockRace, "Test", 1000);
   3.642 -			AddUnitOfTypeToArmy(unitType3, army);
   3.643 -			AddUnitOfTypeToArmy(unitType2, army);
   3.644 -			AddUnitsOfTypeToArmy(6, unitType1, army);
   3.645 -			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1);
   3.646 -			req.AddUnitTypeRequirement(3, unitType2, unitType3);
   3.647 -			Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Passed));
   3.648 -			Assert.That(req.GetValidationMessage(army), Is.Empty);
   3.649 -		}
   3.650 -
   3.651 -		[Test()]
   3.652 -		public void TestValidatingArmyWithSixUnitsWithThreeForEachTwoUnitTypeComboRequiredAndTwoUnitsOfOneTypePasses()
   3.653 -		{
   3.654 -			Army army = new Army(mockRace, "Test", 1000);
   3.655 -			AddUnitsOfTypeToArmy(2, unitType3, army);
   3.656 -			AddUnitsOfTypeToArmy(6, unitType1, army);
   3.657 -			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1);
   3.658 -			req.AddUnitTypeRequirement(3, unitType2, unitType3);
   3.659 -			Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Passed));
   3.660 -			Assert.That(req.GetValidationMessage(army), Is.Empty);
   3.661 -		}
   3.662 -
   3.663 -		[Test()]
   3.664 -		public void TestValidatingArmyWithSixUnitsWithThreeForEachTwoUnitTypeComboRequiredAndTwoUnitsOfOtherTypePasses()
   3.665 -		{
   3.666 -			Army army = new Army(mockRace, "Test", 1000);
   3.667 -			AddUnitsOfTypeToArmy(2, unitType2, army);
   3.668 -			AddUnitsOfTypeToArmy(6, unitType1, army);
   3.669 -			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1);
   3.670 -			req.AddUnitTypeRequirement(3, unitType2, unitType3);
   3.671 -			Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Passed));
   3.672 -			Assert.That(req.GetValidationMessage(army), Is.Empty);
   3.673 -		}
   3.674 -
   3.675 -		[Test()]
   3.676 -		public void TestValidatingArmyWithSevenUnitsWithThreeForEachTwoUnitTypeComboRequiredAndOneUnitOfBothTypesFails()
   3.677 -		{
   3.678 -			Army army = new Army(mockRace, "Test", 1000);
   3.679 -			AddUnitOfTypeToArmy(unitType3, army);
   3.680 -			AddUnitOfTypeToArmy(unitType2, army);
   3.681 -			AddUnitsOfTypeToArmy(7, unitType1, army);
   3.682 -			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1);
   3.683 -			req.AddUnitTypeRequirement(3, unitType2, unitType3);
   3.684 -			Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Failed));
   3.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)."));
   3.686 -		}
   3.687 -
   3.688 -		[Test()]
   3.689 -		public void TestValidatingArmyWithSevenUnitsWithThreeForEachTwoUnitTypeComboRequiredAndTwoUnitsOfOneTypeFails()
   3.690 -		{
   3.691 -			Army army = new Army(mockRace, "Test", 1000);
   3.692 -			AddUnitsOfTypeToArmy(2, unitType3, army);
   3.693 -			AddUnitsOfTypeToArmy(7, unitType1, army);
   3.694 -			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1);
   3.695 -			req.AddUnitTypeRequirement(3, unitType2, unitType3);
   3.696 -			Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Failed));
   3.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)."));
   3.698 -		}
   3.699 -
   3.700 -		[Test()]
   3.701 -		public void TestValidatingArmyWithSevenUnitsWithThreeForEachTwoUnitTypeComboRequiredAndTwoUnitsOfOtherTypeFails()
   3.702 -		{
   3.703 -			Army army = new Army(mockRace, "Test", 1000);
   3.704 -			AddUnitsOfTypeToArmy(2, unitType2, army);
   3.705 -			AddUnitsOfTypeToArmy(7, unitType1, army);
   3.706 -			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType1);
   3.707 -			req.AddUnitTypeRequirement(3, unitType2, unitType3);
   3.708 -			Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Failed));
   3.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)."));
   3.710 -		}
   3.711 -
   3.712 -		private static void AddUnitsOfTypeToArmy(int count, UnitType unitType, Army army)
   3.713 -		{
   3.714 -			for (int i = 0; i < count; i++)
   3.715 -			{
   3.716 -				AddUnitOfTypeToArmy(unitType, army);
   3.717 -			}
   3.718 -		}
   3.719 -
   3.720 -		private static void AddUnitOfTypeToArmy(UnitType unitType, Army army)
   3.721 -		{
   3.722 -			army.AddUnit(CreateUnitOfType(unitType, army));
   3.723 -		}
   3.724 -
   3.725 -		private static Unit CreateUnitOfType(UnitType unitType, Army army)
   3.726 -		{
   3.727 -			return new Unit(unitType, army.GetCategory(unitType.MainCategory));
   3.728 -		}
   3.729 -
   3.730 -		public override RequiresNUnitsForMObjectsRequirement<UnitType> GetObject()
   3.731 -		{
   3.732 -			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType3);
   3.733 -			req.AddUnitTypeRequirement(unitType1, 2, 3);
   3.734 -			return req;
   3.735 -		}
   3.736 -
   3.737 -		public override RequiresNUnitsForMObjectsRequirement<UnitType> GetSameObject()
   3.738 -		{
   3.739 -			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType3);
   3.740 -			req.AddUnitTypeRequirement(unitType1, 2, 3);
   3.741 -			return req;
   3.742 -		}
   3.743 -
   3.744 -		public override RequiresNUnitsForMObjectsRequirement<UnitType> GetDifferentObject()
   3.745 -		{
   3.746 -			RequiresNUnitsForMObjectsRequirement<UnitType> req = CreateRequirement(unitType3);
   3.747 -			DummyWarFoundryFactory factory = new DummyWarFoundryFactory();
   3.748 -			GameSystem gameSystem = new GameSystem("system", "system", factory);
   3.749 -			Race race = new Race("race", "race", gameSystem, factory);
   3.750 -			req.AddUnitTypeRequirement(new UnitType("id2", "Type 2", race), 2, 3);
   3.751 -			return req;
   3.752 -		}
   3.753 -
   3.754 -		protected abstract RequiresNUnitsForMObjectsRequirement<UnitType> CreateRequirement(UnitType allowedType, params UnitType[] requiredUnitTypes);
   3.755 -	}
   3.756 -}
   3.757 -
     4.1 --- a/API/Objects/Requirement/RequiresNoMoreThanNOfUnitTypeRequirementTest.cs	Sun Feb 26 15:38:13 2012 +0000
     4.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.3 @@ -1,272 +0,0 @@
     4.4 -// This file (RequiresNoMoreThanNOfUnitTypeRequirementTest.cs) is a part of the IBBoard.WarFoundry.API.Tests project and is copyright 2011 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 -using NUnit.Framework;
     4.9 -using IBBoard.WarFoundry.API.Objects.Mock;
    4.10 -using NUnit.Framework.SyntaxHelpers;
    4.11 -using System.Reflection;
    4.12 -using IBBoard.NUnit;
    4.13 -using IBBoard.WarFoundry.API.Factories;
    4.14 -
    4.15 -namespace IBBoard.WarFoundry.API.Objects.Requirement
    4.16 -{
    4.17 -	public abstract class RequiresNoMoreThanNOfUnitTypeRequirementTest : AbstractEqualityTest<RequiresNoMoreThanNOfUnitTypeRequirement<UnitType>>
    4.18 -	{
    4.19 -		private MockRace mockRace;
    4.20 -		private UnitType allowedUnitType;
    4.21 -		private UnitType unitType1;
    4.22 -		private UnitType unitType2;
    4.23 -		private UnitType unitType3;
    4.24 -
    4.25 -		[TestFixtureSetUp()]
    4.26 -		public void SetupRace()
    4.27 -		{
    4.28 -			mockRace = new MockRace();
    4.29 -			allowedUnitType = new MockUnitType("allowed", "Allowed Type");
    4.30 -			mockRace.AddUnitType(allowedUnitType);
    4.31 -			unitType1 = new MockUnitType("type1", "Unit Type 1");
    4.32 -			mockRace.AddUnitType(unitType1);
    4.33 -			unitType2 = new MockUnitType("type2", "Unit Type 2");
    4.34 -			mockRace.AddUnitType(unitType2);
    4.35 -			unitType3 = new MockUnitType("type3", "Unit Type 3");
    4.36 -			mockRace.AddUnitType(unitType3);
    4.37 -		}
    4.38 -
    4.39 -		[Test()]
    4.40 -		public void TestAddingUnitWithNoUnitsAndOneUnitTypeRequiredIsAllowed()
    4.41 -		{
    4.42 -			Army army = new Army(mockRace, "Test", 1000);
    4.43 -			Unit unit = CreateUnitOfType(unitType1, army);
    4.44 -			RequiresNoMoreThanNOfUnitTypeRequirement<UnitType> req = new RequiresNoMoreThanNOfUnitTypeRequirement<UnitType>(allowedUnitType, unitType2);
    4.45 -			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Passed));
    4.46 -		}
    4.47 -
    4.48 -		[Test()]
    4.49 -		public void TestAddingUnitWithOneUnitAndOneUnitTypeRequiredIsNotAllowed()
    4.50 -		{
    4.51 -			Army army = new Army(mockRace, "Test", 1000);
    4.52 -			AddUnitOfTypeToArmy(unitType2, army);
    4.53 -			Unit unit = CreateUnitOfType(unitType1, army);
    4.54 -			RequiresNoMoreThanNOfUnitTypeRequirement<UnitType> req = new RequiresNoMoreThanNOfUnitTypeRequirement<UnitType>(allowedUnitType, unitType2);
    4.55 -			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed));
    4.56 -		}
    4.57 -
    4.58 -		[Test()]
    4.59 -		public void TestAddingUnitTypeWithNoUnitsAndOneUnitTypeRequiredIsAllowed()
    4.60 -		{
    4.61 -			Army army = new Army(mockRace, "Test", 1000);
    4.62 -			RequiresNoMoreThanNOfUnitTypeRequirement<UnitType> req = new RequiresNoMoreThanNOfUnitTypeRequirement<UnitType>(allowedUnitType, unitType2);
    4.63 -			Assert.That(req.AllowsAdding(unitType1, army), Is.EqualTo(Validation.Passed));
    4.64 -		}
    4.65 -
    4.66 -		[Test()]
    4.67 -		public void TestAddingUnitTypeWithOneUnitAndOneUnitTypeRequiredIsNotAllowed()
    4.68 -		{
    4.69 -			Army army = new Army(mockRace, "Test", 1000);
    4.70 -			AddUnitOfTypeToArmy(unitType2, army);
    4.71 -			RequiresNoMoreThanNOfUnitTypeRequirement<UnitType> req = new RequiresNoMoreThanNOfUnitTypeRequirement<UnitType>(allowedUnitType, unitType2);
    4.72 -			Assert.That(req.AllowsAdding(unitType1, army), Is.EqualTo(Validation.Failed));
    4.73 -		}
    4.74 -
    4.75 -		[Test()]
    4.76 -		public void TestAddingUnitTypeSetsLimit()
    4.77 -		{
    4.78 -			Army army = new Army(mockRace, "Test", 1000);
    4.79 -			AddUnitOfTypeToArmy(unitType2, army);
    4.80 -			RequiresNoMoreThanNOfUnitTypeRequirement<UnitType> req = new RequiresNoMoreThanNOfUnitTypeRequirement<UnitType>(allowedUnitType);
    4.81 -			req.AddUnitTypeRequirement(unitType2, 1);
    4.82 -			Assert.That(req.AllowsAdding(unitType1, army), Is.EqualTo(Validation.Passed));
    4.83 -		}
    4.84 -
    4.85 -		[Test()]
    4.86 -		public void TestAddingUnitTypeSetsLimitForFailure()
    4.87 -		{
    4.88 -			Army army = new Army(mockRace, "Test", 1000);
    4.89 -			AddUnitOfTypeToArmy(unitType2, army);
    4.90 -			AddUnitOfTypeToArmy(unitType2, army);
    4.91 -			RequiresNoMoreThanNOfUnitTypeRequirement<UnitType> req = new RequiresNoMoreThanNOfUnitTypeRequirement<UnitType>(allowedUnitType);
    4.92 -			req.AddUnitTypeRequirement(unitType2, 1);
    4.93 -			Assert.That(req.AllowsAdding(unitType1, army), Is.EqualTo(Validation.Failed));
    4.94 -		}
    4.95 -
    4.96 -		[Test()]
    4.97 -		public void TestAddingUnitTypeDefaultsToNoMoreThanZero()
    4.98 -		{
    4.99 -			Army army = new Army(mockRace, "Test", 1000);
   4.100 -			RequiresNoMoreThanNOfUnitTypeRequirement<UnitType> req = new RequiresNoMoreThanNOfUnitTypeRequirement<UnitType>(allowedUnitType);
   4.101 -			req.AddUnitTypeRequirement(unitType2);
   4.102 -			Assert.That(req.AllowsAdding(unitType1, army), Is.EqualTo(Validation.Passed));
   4.103 -			AddUnitOfTypeToArmy(unitType2, army);
   4.104 -			Assert.That(req.AllowsAdding(unitType1, army), Is.EqualTo(Validation.Failed));
   4.105 -		}
   4.106 -
   4.107 -		[Test]
   4.108 -		public void TestRequirementBecomesInvalidWhenProhibitedUnitsChange()
   4.109 -		{
   4.110 -			Army army = new Army(mockRace, "Test", 1000);
   4.111 -			RequiresNoMoreThanNOfUnitTypeRequirement<UnitType> req = new RequiresNoMoreThanNOfUnitTypeRequirement<UnitType>(allowedUnitType);
   4.112 -			req.AddUnitTypeRequirement(unitType2);
   4.113 -			Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Passed));
   4.114 -			AddUnitOfTypeToArmy(unitType2, army);
   4.115 -			Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Failed));
   4.116 -		}
   4.117 -
   4.118 -		[Test]
   4.119 -		public void TestValidationMessageIsBlankForPass()
   4.120 -		{
   4.121 -			Army army = new Army(mockRace, "Test", 1000);
   4.122 -			RequiresNoMoreThanNOfUnitTypeRequirement<UnitType> req = new RequiresNoMoreThanNOfUnitTypeRequirement<UnitType>(allowedUnitType, unitType1);
   4.123 -			Assert.That(req.GetValidationMessage(army), Is.Empty);
   4.124 -		}
   4.125 -
   4.126 -		[Test]
   4.127 -		public void TestValidationMessageIsCorrectForFailWithOneUnitProhibited()
   4.128 -		{
   4.129 -			Army army = new Army(mockRace, "Test", 1000);
   4.130 -			AddUnitOfTypeToArmy(unitType1, army);
   4.131 -			RequiresNoMoreThanNOfUnitTypeRequirement<UnitType> req = new RequiresNoMoreThanNOfUnitTypeRequirement<UnitType>(allowedUnitType, unitType1);
   4.132 -			Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army cannot contain more than: 0 × " + unitType1.Name + " (have 1)."));
   4.133 -		}
   4.134 -
   4.135 -		[Test]
   4.136 -		public void TestValidationMessageIsCorrectForFailWithTwoOfOneUnitLimit()
   4.137 -		{
   4.138 -			Army army = new Army(mockRace, "Test", 1000);
   4.139 -			AddUnitOfTypeToArmy(unitType1, army);
   4.140 -			AddUnitOfTypeToArmy(unitType1, army);
   4.141 -			AddUnitOfTypeToArmy(unitType1, army);
   4.142 -			RequiresNoMoreThanNOfUnitTypeRequirement<UnitType> req = new RequiresNoMoreThanNOfUnitTypeRequirement<UnitType>(allowedUnitType);
   4.143 -			req.AddUnitTypeRequirement(unitType1, 2);
   4.144 -			Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army cannot contain more than: 2 × " + unitType1.Name + " (have 3)."));
   4.145 -		}
   4.146 -
   4.147 -		[Test]
   4.148 -		public void TestValidationMessageIsCorrectForFailWithTwoUnitsProhibited()
   4.149 -		{
   4.150 -			Army army = new Army(mockRace, "Test", 1000);
   4.151 -			AddUnitOfTypeToArmy(unitType1, army);
   4.152 -			AddUnitOfTypeToArmy(unitType2, army);
   4.153 -			RequiresNoMoreThanNOfUnitTypeRequirement<UnitType> req = new RequiresNoMoreThanNOfUnitTypeRequirement<UnitType>(allowedUnitType);
   4.154 -			req.AddUnitTypeRequirement(unitType1);
   4.155 -			req.AddUnitTypeRequirement(unitType2);
   4.156 -			Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army cannot contain more than: 0 × " + unitType1.Name + " (have 1); 0 × " + unitType2.Name + " (have 1)."));
   4.157 -		}
   4.158 -
   4.159 -		[Test]
   4.160 -		public void TestValidationMessageIsCorrectForFailWithTwoUnitsProhibitedAndOneUnitInArmy()
   4.161 -		{
   4.162 -			Army army = new Army(mockRace, "Test", 1000);
   4.163 -			AddUnitOfTypeToArmy(unitType1, army);
   4.164 -			RequiresNoMoreThanNOfUnitTypeRequirement<UnitType> req = new RequiresNoMoreThanNOfUnitTypeRequirement<UnitType>(allowedUnitType);
   4.165 -			req.AddUnitTypeRequirement(unitType1);
   4.166 -			req.AddUnitTypeRequirement(unitType2);
   4.167 -			Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army cannot contain more than: 0 × " + unitType1.Name + " (have 1)."));
   4.168 -		}
   4.169 -
   4.170 -		[Test]
   4.171 -		public void TestValidationMessageIsCorrectForFailWithTwoUnitsProhibitedAndOtherUnitInArmy()
   4.172 -		{
   4.173 -			Army army = new Army(mockRace, "Test", 1000);
   4.174 -			AddUnitOfTypeToArmy(unitType2, army);
   4.175 -			RequiresNoMoreThanNOfUnitTypeRequirement<UnitType> req = new RequiresNoMoreThanNOfUnitTypeRequirement<UnitType>(allowedUnitType);
   4.176 -			req.AddUnitTypeRequirement(unitType1);
   4.177 -			req.AddUnitTypeRequirement(unitType2);
   4.178 -			Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army cannot contain more than: 0 × " + unitType2.Name + " (have 1)."));
   4.179 -		}
   4.180 -
   4.181 -		[Test]
   4.182 -		public void TestAllowsAddMessageIsBlankForPass()
   4.183 -		{
   4.184 -			Army army = new Army(mockRace, "Test", 1000);
   4.185 -			RequiresNoMoreThanNOfUnitTypeRequirement<UnitType> req = new RequiresNoMoreThanNOfUnitTypeRequirement<UnitType>(allowedUnitType, unitType1);
   4.186 -			Assert.That(req.GetAllowsAddingMessage(unitType2, army), Is.Empty);
   4.187 -		}
   4.188 -
   4.189 -		[Test]
   4.190 -		public void TestAllowsAddMessageIsCorrectForFailWithOneUnitProhibited()
   4.191 -		{
   4.192 -			Army army = new Army(mockRace, "Test", 1000);
   4.193 -			RequiresNoMoreThanNOfUnitTypeRequirement<UnitType> req = new RequiresNoMoreThanNOfUnitTypeRequirement<UnitType>(allowedUnitType, unitType1);
   4.194 -			Assert.That(req.GetAllowsAddingMessage(unitType1, army), Is.EqualTo("Army cannot contain more than: 0 × " + unitType1.Name + " (would have 1)."));
   4.195 -		}
   4.196 -
   4.197 -		[Test]
   4.198 -		public void TestAllowsAddMessageIsCorrectForFailWithTwoOfOneUnitLimit()
   4.199 -		{
   4.200 -			Army army = new Army(mockRace, "Test", 1000);
   4.201 -			AddUnitOfTypeToArmy(unitType1, army);
   4.202 -			AddUnitOfTypeToArmy(unitType1, army);
   4.203 -			RequiresNoMoreThanNOfUnitTypeRequirement<UnitType> req = new RequiresNoMoreThanNOfUnitTypeRequirement<UnitType>(allowedUnitType);
   4.204 -			req.AddUnitTypeRequirement(unitType1, 2);
   4.205 -			Assert.That(req.GetAllowsAddingMessage(unitType1, army), Is.EqualTo("Army cannot contain more than: 2 × " + unitType1.Name + " (would have 3)."));
   4.206 -		}
   4.207 -
   4.208 -		[Test]
   4.209 -		public void TestAllowsAddMessageIsCorrectForFailWithTwoUnitsProhibited()
   4.210 -		{
   4.211 -			Army army = new Army(mockRace, "Test", 1000);
   4.212 -			RequiresNoMoreThanNOfUnitTypeRequirement<UnitType> req = new RequiresNoMoreThanNOfUnitTypeRequirement<UnitType>(allowedUnitType);
   4.213 -			req.AddUnitTypeRequirement(unitType1);
   4.214 -			req.AddUnitTypeRequirement(unitType2);
   4.215 -			Assert.That(req.GetAllowsAddingMessage(unitType1, army), Is.EqualTo("Army cannot contain more than: 0 × " + unitType1.Name + " (would have 1)."));
   4.216 -		}
   4.217 -
   4.218 -		[Test]
   4.219 -		public void TestAllowsAddMessageIsCorrectForFailWithTwoUnitsProhibitedAndOneUnitInArmy()
   4.220 -		{
   4.221 -			Army army = new Army(mockRace, "Test", 1000);
   4.222 -			AddUnitOfTypeToArmy(unitType1, army);
   4.223 -			RequiresNoMoreThanNOfUnitTypeRequirement<UnitType> req = new RequiresNoMoreThanNOfUnitTypeRequirement<UnitType>(allowedUnitType);
   4.224 -			req.AddUnitTypeRequirement(unitType1);
   4.225 -			req.AddUnitTypeRequirement(unitType2);
   4.226 -			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)."));
   4.227 -		}
   4.228 -
   4.229 -		[Test]
   4.230 -		public void TestAllowsAddMessageIsCorrectForFailWithTwoUnitsProhibitedAndOtherUnitInArmy()
   4.231 -		{
   4.232 -			Army army = new Army(mockRace, "Test", 1000);
   4.233 -			AddUnitOfTypeToArmy(unitType2, army);
   4.234 -			RequiresNoMoreThanNOfUnitTypeRequirement<UnitType> req = new RequiresNoMoreThanNOfUnitTypeRequirement<UnitType>(allowedUnitType);
   4.235 -			req.AddUnitTypeRequirement(unitType1);
   4.236 -			req.AddUnitTypeRequirement(unitType2);
   4.237 -			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)."));
   4.238 -		}
   4.239 -
   4.240 -		private static void AddUnitOfTypeToArmy(UnitType unitType, Army army)
   4.241 -		{
   4.242 -			army.AddUnit(CreateUnitOfType(unitType, army));
   4.243 -		}
   4.244 -
   4.245 -		private static Unit CreateUnitOfType(UnitType unitType, Army army)
   4.246 -		{
   4.247 -			return new Unit(unitType, army.GetCategory(unitType.MainCategory));
   4.248 -		}
   4.249 -
   4.250 -		public override RequiresNoMoreThanNOfUnitTypeRequirement<UnitType> GetObject()
   4.251 -		{
   4.252 -			RequiresNoMoreThanNOfUnitTypeRequirement<UnitType> req = new RequiresNoMoreThanNOfUnitTypeRequirement<UnitType>(allowedUnitType);
   4.253 -			req.AddUnitTypeRequirement(unitType1, 2);
   4.254 -			return req;
   4.255 -		}
   4.256 -
   4.257 -		public override RequiresNoMoreThanNOfUnitTypeRequirement<UnitType> GetSameObject()
   4.258 -		{
   4.259 -			RequiresNoMoreThanNOfUnitTypeRequirement<UnitType> req = new RequiresNoMoreThanNOfUnitTypeRequirement<UnitType>(allowedUnitType);
   4.260 -			req.AddUnitTypeRequirement(unitType1, 2);
   4.261 -			return req;
   4.262 -		}
   4.263 -
   4.264 -		public override RequiresNoMoreThanNOfUnitTypeRequirement<UnitType> GetDifferentObject()
   4.265 -		{
   4.266 -			RequiresNoMoreThanNOfUnitTypeRequirement<UnitType> req = new RequiresNoMoreThanNOfUnitTypeRequirement<UnitType>(allowedUnitType);
   4.267 -			DummyWarFoundryFactory factory = new DummyWarFoundryFactory();
   4.268 -			GameSystem gameSystem = new GameSystem("system", "system", factory);
   4.269 -			Race race = new Race("race", "race", gameSystem, factory);
   4.270 -			req.AddUnitTypeRequirement(new UnitType("id2", "Type 2", race), 2);
   4.271 -			return req;
   4.272 -		}
   4.273 -	}
   4.274 -}
   4.275 -
     5.1 --- a/API/Objects/Requirement/UnitRequiresAtLeastNUnitsRequirementTest.cs	Sun Feb 26 15:38:13 2012 +0000
     5.2 +++ b/API/Objects/Requirement/UnitRequiresAtLeastNUnitsRequirementTest.cs	Sun Feb 26 20:18:45 2012 +0000
     5.3 @@ -1,4 +1,4 @@
     5.4 -// This file (UnitRequiresAtLeastNUnitsRequirement.cs) is a part of the IBBoard.WarFoundry.API.Tests project and is copyright 2011 IBBoard
     5.5 +// This file (UnitRequiresAtLeastNUnitsRequirementTest.cs) is a part of the IBBoard.WarFoundry.API.Tests project and is copyright 2011 IBBoard
     5.6  // 
     5.7  // 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.
     5.8  using System;
     5.9 @@ -32,30 +32,9 @@
    5.10  		public void TestAddingUnitWithNoUnitsAndOneUnitTypeRequired()
    5.11  		{
    5.12  			Army army = new Army(mockRace, "Test", 1000);
    5.13 -			Unit unit = CreateUnitOfType(unitType1, army);
    5.14  			UnitRequiresAtLeastNUnitsRequirement req = new UnitRequiresAtLeastNUnitsRequirement(unitType1);
    5.15  			req.AddUnitTypeRequirement(unitType2);
    5.16 -			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed));
    5.17 -		}
    5.18 -
    5.19 -		[Test()]
    5.20 -		public void TestAddingUnitWithOneUnitAndOneUnitTypeRequired()
    5.21 -		{
    5.22 -			Army army = new Army(mockRace, "Test", 1000);
    5.23 -			AddUnitOfTypeToArmy(unitType2, army);
    5.24 -			Unit unit = CreateUnitOfType(unitType1, army);
    5.25 -			UnitRequiresAtLeastNUnitsRequirement req = new UnitRequiresAtLeastNUnitsRequirement(unitType1);
    5.26 -			req.AddUnitTypeRequirement(unitType2);
    5.27 -			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Passed));
    5.28 -		}
    5.29 -
    5.30 -		[Test()]
    5.31 -		public void TestAddingUnitTypeWithNoUnitsAndOneUnitTypeRequired()
    5.32 -		{
    5.33 -			Army army = new Army(mockRace, "Test", 1000);
    5.34 -			UnitRequiresAtLeastNUnitsRequirement req = new UnitRequiresAtLeastNUnitsRequirement(unitType1);
    5.35 -			req.AddUnitTypeRequirement(unitType2);
    5.36 -			Assert.That(req.AllowsAdding(unitType1, army), Is.EqualTo(Validation.Failed));
    5.37 +			Assert_That__FailsAdding(req, unitType1, army, "Army must contain: 1 × " + unitType2.Name + " (would have 0).");
    5.38  		}
    5.39  
    5.40  		[Test()]
    5.41 @@ -65,7 +44,7 @@
    5.42  			AddUnitOfTypeToArmy(unitType2, army);
    5.43  			UnitRequiresAtLeastNUnitsRequirement req = new UnitRequiresAtLeastNUnitsRequirement(unitType1);
    5.44  			req.AddUnitTypeRequirement(unitType2);
    5.45 -			Assert.That(req.AllowsAdding(unitType1, army), Is.EqualTo(Validation.Passed));
    5.46 +			Assert_That__PassesAdding(req, unitType1, army);
    5.47  		}
    5.48  
    5.49  		[Test()]
    5.50 @@ -75,7 +54,7 @@
    5.51  			UnitRequiresAtLeastNUnitsRequirement req = new UnitRequiresAtLeastNUnitsRequirement(unitType1);
    5.52  			req.AddUnitTypeRequirement(unitType2);
    5.53  			req.AddUnitTypeRequirement(unitType3);
    5.54 -			Assert.That(req.AllowsAdding(unitType1, army), Is.EqualTo(Validation.Failed));
    5.55 +			Assert_That__FailsAdding(req, unitType1, army, "Army must contain: 1 × " + unitType2.Name + " (would have 0); 1 × " + unitType3.Name + " (would have 0).");
    5.56  		}
    5.57  
    5.58  		[Test()]
    5.59 @@ -86,7 +65,7 @@
    5.60  			UnitRequiresAtLeastNUnitsRequirement req = new UnitRequiresAtLeastNUnitsRequirement(unitType1);
    5.61  			req.AddUnitTypeRequirement(unitType2);
    5.62  			req.AddUnitTypeRequirement(unitType3);
    5.63 -			Assert.That(req.AllowsAdding(unitType1, army), Is.EqualTo(Validation.Failed));
    5.64 +			Assert_That__FailsAdding(req, unitType1, army, "Army must contain: 1 × " + unitType3.Name + " (would have 0).");
    5.65  		}
    5.66  
    5.67  		[Test()]
    5.68 @@ -97,7 +76,7 @@
    5.69  			UnitRequiresAtLeastNUnitsRequirement req = new UnitRequiresAtLeastNUnitsRequirement(unitType1);
    5.70  			req.AddUnitTypeRequirement(unitType2);
    5.71  			req.AddUnitTypeRequirement(unitType3);
    5.72 -			Assert.That(req.AllowsAdding(unitType1, army), Is.EqualTo(Validation.Failed));
    5.73 +			Assert_That__FailsAdding(req, unitType1, army, "Army must contain: 1 × " + unitType2.Name + " (would have 0).");
    5.74  		}
    5.75  
    5.76  		[Test()]
    5.77 @@ -109,7 +88,7 @@
    5.78  			UnitRequiresAtLeastNUnitsRequirement req = new UnitRequiresAtLeastNUnitsRequirement(unitType1);
    5.79  			req.AddUnitTypeRequirement(unitType2);
    5.80  			req.AddUnitTypeRequirement(unitType3);
    5.81 -			Assert.That(req.AllowsAdding(unitType1, army), Is.EqualTo(Validation.Passed));
    5.82 +			Assert_That__PassesAdding(req, unitType1, army);
    5.83  		}
    5.84  
    5.85  		[Test()]
    5.86 @@ -119,17 +98,26 @@
    5.87  			AddUnitOfTypeToArmy(unitType2, army);
    5.88  			UnitRequiresAtLeastNUnitsRequirement req = new UnitRequiresAtLeastNUnitsRequirement(unitType1);
    5.89  			req.AddUnitTypeRequirement(unitType2, 2);
    5.90 -			Assert.That(req.AllowsAdding(unitType1, army), Is.EqualTo(Validation.Failed));
    5.91 +			Assert_That__FailsAdding(req, unitType1, army, "Army must contain: 2 × " + unitType2.Name + " (would have 1).");
    5.92  		}
    5.93  
    5.94  		[Test()]
    5.95 -		public void TestAddingUnrelatedUnitTypeIsAllowedWhenRequirementsNotMet()
    5.96 +		public void TestAddingUnrelatedUnitTypeValidatesAsNotApplicable()
    5.97  		{
    5.98  			Army army = new Army(mockRace, "Test", 1000);
    5.99 -			AddUnitOfTypeToArmy(unitType2, army);
   5.100  			UnitRequiresAtLeastNUnitsRequirement req = new UnitRequiresAtLeastNUnitsRequirement(unitType1);
   5.101  			req.AddUnitTypeRequirement(unitType2, 2);
   5.102 -			Assert.That(req.AllowsAdding(unitType3, army), Is.EqualTo(Validation.NotApplicable));
   5.103 +			Assert_That__AddingNotApplicable(req, unitType3, army);
   5.104 +		}
   5.105 +
   5.106 +		[Test()]
   5.107 +		public void TestAddingUnrelatedUnitTypeValidatesAsNotApplicableWhenRequirementsNotMet()
   5.108 +		{
   5.109 +			Army army = new Army(mockRace, "Test", 1000);
   5.110 +			AddUnitOfTypeToArmy(unitType1, army);
   5.111 +			UnitRequiresAtLeastNUnitsRequirement req = new UnitRequiresAtLeastNUnitsRequirement(unitType1);
   5.112 +			req.AddUnitTypeRequirement(unitType2, 2);
   5.113 +			Assert_That__AddingNotApplicable(req, unitType3, army);
   5.114  		}
   5.115  
   5.116  		[Test()]
   5.117 @@ -140,7 +128,7 @@
   5.118  			AddUnitOfTypeToArmy(unitType2, army);
   5.119  			UnitRequiresAtLeastNUnitsRequirement req = new UnitRequiresAtLeastNUnitsRequirement(unitType1);
   5.120  			req.AddUnitTypeRequirement(unitType2, 2);
   5.121 -			Assert.That(req.AllowsAdding(unitType1, army), Is.EqualTo(Validation.Passed));
   5.122 +			Assert_That__PassesAdding(req, unitType1, army);
   5.123  		}
   5.124  
   5.125  		[Test()]
   5.126 @@ -150,7 +138,7 @@
   5.127  			AddUnitOfTypeToArmy(unitType2, army);
   5.128  			UnitRequiresAtLeastNUnitsRequirement req = new UnitRequiresAtLeastNUnitsRequirement(unitType1);
   5.129  			req.AddUnitTypeRequirement(unitType2);
   5.130 -			Assert.That(req.AllowsAdding(unitType1, army), Is.EqualTo(Validation.Passed));
   5.131 +			Assert_That__PassesAdding(req, unitType1, army);
   5.132  		}
   5.133  
   5.134  		[Test()]
   5.135 @@ -160,166 +148,137 @@
   5.136  			AddUnitOfTypeToArmy(unitType2, army);
   5.137  			UnitRequiresAtLeastNUnitsRequirement req = new UnitRequiresAtLeastNUnitsRequirement(unitType1);
   5.138  			req.AddUnitTypeRequirement(unitType2, 2);
   5.139 -			Assert.That(req.AllowsAdding(unitType1, army), Is.EqualTo(Validation.Failed));
   5.140 +			Assert_That__FailsAdding(req, unitType1, army, "Army must contain: 2 × " + unitType2.Name + " (would have 1).");
   5.141  			AddUnitOfTypeToArmy(unitType2, army);
   5.142 -			Assert.That(req.AllowsAdding(unitType1, army), Is.EqualTo(Validation.Passed));
   5.143 +			Assert_That__PassesAdding(req, unitType1, army);
   5.144  		}
   5.145  
   5.146  		[Test()]
   5.147 -		public void TestValidityOfArmyWithNoUnitsAndOneUnitTypeRequired()
   5.148 +		public void TestValidatingWithNoUnitsAndOneUnitTypeRequired()
   5.149  		{
   5.150  			Army army = new Army(mockRace, "Test", 1000);
   5.151 -			AddUnitOfTypeToArmy(unitType1, army);
   5.152  			UnitRequiresAtLeastNUnitsRequirement req = new UnitRequiresAtLeastNUnitsRequirement(unitType1);
   5.153  			req.AddUnitTypeRequirement(unitType2);
   5.154 -			Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Failed));
   5.155 +			AddUnitOfTypeToArmy(unitType1, army);
   5.156 +			Assert_That__ValidationFails(req, army, "Army must contain: 1 × " + unitType2.Name + " (have 0).");
   5.157  		}
   5.158  
   5.159  		[Test()]
   5.160 -		public void TestValidityOfArmyWithOneUnitAndOneUnitTypeRequired()
   5.161 -		{
   5.162 -			Army army = new Army(mockRace, "Test", 1000);
   5.163 -			AddUnitOfTypeToArmy(unitType2, army);
   5.164 -			AddUnitOfTypeToArmy(unitType1, army);
   5.165 -			UnitRequiresAtLeastNUnitsRequirement req = new UnitRequiresAtLeastNUnitsRequirement(unitType1);
   5.166 -			req.AddUnitTypeRequirement(unitType2);
   5.167 -			Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Passed));
   5.168 -		}
   5.169 -
   5.170 -		[Test()]
   5.171 -		public void TestValidityOfArmyWhenNoRequireeAndRequirementNotMet()
   5.172 -		{
   5.173 -			Army army = new Army(mockRace, "Test", 1000);
   5.174 -			AddUnitOfTypeToArmy(unitType2, army);
   5.175 -			UnitRequiresAtLeastNUnitsRequirement req = new UnitRequiresAtLeastNUnitsRequirement(unitType1);
   5.176 -			req.AddUnitTypeRequirement(unitType2, 2);
   5.177 -			Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.NotApplicable));
   5.178 -		}
   5.179 -
   5.180 -		[Test]
   5.181 -		public void TestSatisfyingRequirementChangesResult()
   5.182 -		{
   5.183 -			Army army = new Army(mockRace, "Test", 1000);
   5.184 -			AddUnitOfTypeToArmy(unitType1, army);
   5.185 -			UnitRequiresAtLeastNUnitsRequirement req = new UnitRequiresAtLeastNUnitsRequirement(unitType1);
   5.186 -			req.AddUnitTypeRequirement(unitType2);
   5.187 -			Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Failed));
   5.188 -			AddUnitOfTypeToArmy(unitType2, army);
   5.189 -			Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Passed));
   5.190 -		}
   5.191 -
   5.192 -		[Test]
   5.193 -		public void TestAddingMinNumberUnitTypePassesRequirement()
   5.194 -		{
   5.195 -			Army army = new Army(mockRace, "Test", 1000);
   5.196 -			AddUnitOfTypeToArmy(unitType1, army);
   5.197 -			UnitRequiresAtLeastNUnitsRequirement req = new UnitRequiresAtLeastNUnitsRequirement(unitType1);
   5.198 -			req.AddUnitTypeRequirement(unitType2, 2);
   5.199 -			Assert.That(req.AllowsAdding(unitType2, army), Is.EqualTo(Validation.Failed));
   5.200 -			AddUnitOfTypeToArmy(unitType2, army);
   5.201 -			Assert.That(req.AllowsAdding(unitType2, army), Is.EqualTo(Validation.Passed));
   5.202 -		}
   5.203 -
   5.204 -		[Test]
   5.205 -		public void TestValidationMessageIsBlankForPass()
   5.206 +		public void TestValidatingWithOneUnitAndOneUnitTypeRequired()
   5.207  		{
   5.208  			Army army = new Army(mockRace, "Test", 1000);
   5.209  			AddUnitOfTypeToArmy(unitType1, army);
   5.210  			AddUnitOfTypeToArmy(unitType2, army);
   5.211  			UnitRequiresAtLeastNUnitsRequirement req = new UnitRequiresAtLeastNUnitsRequirement(unitType1);
   5.212  			req.AddUnitTypeRequirement(unitType2);
   5.213 -			Assert.That(req.GetValidationMessage(army), Is.Empty);
   5.214 +			Assert_That__ValidationPasses(req, army);
   5.215  		}
   5.216  
   5.217 -		[Test]
   5.218 -		public void TestValidationMessageIsCorrectForFailWithOneUnitRequired()
   5.219 -		{
   5.220 -			Army army = new Army(mockRace, "Test", 1000);
   5.221 -			AddUnitOfTypeToArmy(unitType1, army);
   5.222 -			UnitRequiresAtLeastNUnitsRequirement req = new UnitRequiresAtLeastNUnitsRequirement(unitType1);
   5.223 -			req.AddUnitTypeRequirement(unitType2);
   5.224 -			Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " (have 0)."));
   5.225 -		}
   5.226 -
   5.227 -		[Test]
   5.228 -		public void TestValidationMessageIsCorrectForFailWithTwoOfOneUnitRequired()
   5.229 -		{
   5.230 -			Army army = new Army(mockRace, "Test", 1000);
   5.231 -			AddUnitOfTypeToArmy(unitType1, army);
   5.232 -			UnitRequiresAtLeastNUnitsRequirement req = new UnitRequiresAtLeastNUnitsRequirement(unitType1);
   5.233 -			req.AddUnitTypeRequirement(unitType2, 2);
   5.234 -			Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 2 × " + unitType2.Name + " (have 0)."));
   5.235 -		}
   5.236 -
   5.237 -		[Test]
   5.238 -		public void TestValidationMessageIsCorrectForFailWithTwoUnitsRequired()
   5.239 -		{
   5.240 -			Army army = new Army(mockRace, "Test", 1000);
   5.241 -			AddUnitOfTypeToArmy(unitType1, army);
   5.242 -			UnitRequiresAtLeastNUnitsRequirement req = new UnitRequiresAtLeastNUnitsRequirement(unitType1);
   5.243 -			req.AddUnitTypeRequirement(unitType2);
   5.244 -			req.AddUnitTypeRequirement(unitType3);
   5.245 -			Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " (have 0); 1 × " + unitType3.Name + " (have 0)."));
   5.246 -		}
   5.247 -
   5.248 -		[Test]
   5.249 -		public void TestAllowsAddingMessageIsBlankForPass()
   5.250 -		{
   5.251 -			Army army = new Army(mockRace, "Test", 1000);
   5.252 -			AddUnitOfTypeToArmy(unitType1, army);
   5.253 -			UnitRequiresAtLeastNUnitsRequirement req = new UnitRequiresAtLeastNUnitsRequirement(unitType1);
   5.254 -			Assert.That(req.GetAllowsAddingMessage(unitType1, army), Is.Empty);
   5.255 -		}
   5.256 -
   5.257 -		[Test]
   5.258 -		public void TestAllowsAddingMessageIsCorrectForFailWithTwoOfOneUnitRequired()
   5.259 -		{
   5.260 -			Army army = new Army(mockRace, "Test", 1000);
   5.261 -			UnitRequiresAtLeastNUnitsRequirement req = new UnitRequiresAtLeastNUnitsRequirement(unitType1);
   5.262 -			req.AddUnitTypeRequirement(unitType2, 2);
   5.263 -			Assert.That(req.GetAllowsAddingMessage(unitType2, army), Is.EqualTo("Army must contain: 2 × " + unitType2.Name + " (would have 1)."));
   5.264 -		}
   5.265 -
   5.266 -		[Test]
   5.267 -		public void TestAllowsAddingMessageIsCorrectForFailWithTwoUnitsRequired()
   5.268 +		[Test()]
   5.269 +		public void TestValidatingWithNoUnitsAndTwoUnitTypesRequired()
   5.270  		{
   5.271  			Army army = new Army(mockRace, "Test", 1000);
   5.272  			UnitRequiresAtLeastNUnitsRequirement req = new UnitRequiresAtLeastNUnitsRequirement(unitType1);
   5.273  			req.AddUnitTypeRequirement(unitType2);
   5.274  			req.AddUnitTypeRequirement(unitType3);
   5.275 -			Assert.That(req.GetAllowsAddingMessage(unitType2, army), Is.EqualTo("Army must contain: 1 × " + unitType3.Name + " (would have 0)."));
   5.276 +			AddUnitOfTypeToArmy(unitType1, army);
   5.277 +			Assert_That__ValidationFails(req, army, "Army must contain: 1 × " + unitType2.Name + " (have 0); 1 × " + unitType3.Name + " (have 0).");
   5.278  		}
   5.279  
   5.280 -		[Test]
   5.281 -		public void TestAllowsAddingMessageIsCorrectForFailWithTwoUnitsRequiredOtherUnit()
   5.282 +		[Test()]
   5.283 +		public void TestValidatingWithOneUnitAndTwoUnitTypesRequired()
   5.284  		{
   5.285  			Army army = new Army(mockRace, "Test", 1000);
   5.286 -			UnitRequiresAtLeastNUnitsRequirement req = new UnitRequiresAtLeastNUnitsRequirement(unitType1);
   5.287 -			req.AddUnitTypeRequirement(unitType2);
   5.288 -			req.AddUnitTypeRequirement(unitType3);
   5.289 -			Assert.That(req.GetAllowsAddingMessage(unitType3, army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " (would have 0)."));
   5.290 -		}
   5.291 -
   5.292 -		[Test]
   5.293 -		public void TestAllowsAddingMessageIsCorrectForFailWithTwoUnitsRequiredWithOneUnit()
   5.294 -		{
   5.295 -			Army army = new Army(mockRace, "Test", 1000);
   5.296 +			AddUnitOfTypeToArmy(unitType1, army);
   5.297  			AddUnitOfTypeToArmy(unitType2, army);
   5.298  			UnitRequiresAtLeastNUnitsRequirement req = new UnitRequiresAtLeastNUnitsRequirement(unitType1);
   5.299  			req.AddUnitTypeRequirement(unitType2);
   5.300  			req.AddUnitTypeRequirement(unitType3);
   5.301 -			Assert.That(req.GetAllowsAddingMessage(unitType2, army), Is.EqualTo("Army must contain: 1 × " + unitType3.Name + " (would have 0)."));
   5.302 +			Assert_That__ValidationFails(req, army, "Army must contain: 1 × " + unitType3.Name + " (have 0).");
   5.303  		}
   5.304  
   5.305 -		[Test]
   5.306 -		public void TestAllowsAddingMessageIsCorrectForFailWithTwoUnitsRequiredWithOtherUnit()
   5.307 +		[Test()]
   5.308 +		public void TestValidatingWithOtherOneUnitAndTwoUnitTypesRequired()
   5.309 +		{
   5.310 +			Army army = new Army(mockRace, "Test", 1000);
   5.311 +			AddUnitOfTypeToArmy(unitType1, army);
   5.312 +			AddUnitOfTypeToArmy(unitType3, army);
   5.313 +			UnitRequiresAtLeastNUnitsRequirement req = new UnitRequiresAtLeastNUnitsRequirement(unitType1);
   5.314 +			req.AddUnitTypeRequirement(unitType2);
   5.315 +			req.AddUnitTypeRequirement(unitType3);
   5.316 +			AddUnitOfTypeToArmy(unitType1, army);
   5.317 +			Assert_That__ValidationFails(req, army, "Army must contain: 1 × " + unitType2.Name + " (have 0).");
   5.318 +		}
   5.319 +
   5.320 +		[Test()]
   5.321 +		public void TestValidatingWithBothUnitsAndTwoUnitTypesRequired()
   5.322 +		{
   5.323 +			Army army = new Army(mockRace, "Test", 1000);
   5.324 +			AddUnitOfTypeToArmy(unitType1, army);
   5.325 +			AddUnitOfTypeToArmy(unitType2, army);
   5.326 +			AddUnitOfTypeToArmy(unitType3, army);
   5.327 +			UnitRequiresAtLeastNUnitsRequirement req = new UnitRequiresAtLeastNUnitsRequirement(unitType1);
   5.328 +			req.AddUnitTypeRequirement(unitType2);
   5.329 +			req.AddUnitTypeRequirement(unitType3);
   5.330 +			Assert_That__ValidationPasses(req, army);
   5.331 +		}
   5.332 +
   5.333 +		[Test()]
   5.334 +		public void TestValidatingWithOneUnitAndTwoOfOneUnitTypeRequired()
   5.335 +		{
   5.336 +			Army army = new Army(mockRace, "Test", 1000);
   5.337 +			AddUnitOfTypeToArmy(unitType1, army);
   5.338 +			AddUnitOfTypeToArmy(unitType2, army);
   5.339 +			UnitRequiresAtLeastNUnitsRequirement req = new UnitRequiresAtLeastNUnitsRequirement(unitType1);
   5.340 +			req.AddUnitTypeRequirement(unitType2, 2);
   5.341 +			AddUnitOfTypeToArmy(unitType1, army);
   5.342 +			Assert_That__ValidationFails(req, army, "Army must contain: 2 × " + unitType2.Name + " (have 1).");
   5.343 +		}
   5.344 +
   5.345 +		[Test()]
   5.346 +		public void TestValidatingWithUnrelatedUnitTypeValidatesAsNotApplicable()
   5.347  		{
   5.348  			Army army = new Army(mockRace, "Test", 1000);
   5.349  			AddUnitOfTypeToArmy(unitType3, army);
   5.350  			UnitRequiresAtLeastNUnitsRequirement req = new UnitRequiresAtLeastNUnitsRequirement(unitType1);
   5.351 +			req.AddUnitTypeRequirement(unitType2, 2);
   5.352 +			Assert_That__NotApplicable(req, army);
   5.353 +		}
   5.354 +
   5.355 +		[Test()]
   5.356 +		public void TestValidatingWithTwoUnitsAndTwoOfOneUnitTypeRequired()
   5.357 +		{
   5.358 +			Army army = new Army(mockRace, "Test", 1000);
   5.359 +			AddUnitOfTypeToArmy(unitType1, army);
   5.360 +			AddUnitOfTypeToArmy(unitType2, army);
   5.361 +			AddUnitOfTypeToArmy(unitType2, army);
   5.362 +			UnitRequiresAtLeastNUnitsRequirement req = new UnitRequiresAtLeastNUnitsRequirement(unitType1);
   5.363 +			req.AddUnitTypeRequirement(unitType2, 2);
   5.364 +			Assert_That__ValidationPasses(req, army);
   5.365 +		}
   5.366 +
   5.367 +		[Test()]
   5.368 +		public void TestValidatingRequirementWithNoNumberDefaultsToHavingOne()
   5.369 +		{
   5.370 +			Army army = new Army(mockRace, "Test", 1000);
   5.371 +			AddUnitOfTypeToArmy(unitType1, army);
   5.372 +			AddUnitOfTypeToArmy(unitType2, army);
   5.373 +			UnitRequiresAtLeastNUnitsRequirement req = new UnitRequiresAtLeastNUnitsRequirement(unitType1);
   5.374  			req.AddUnitTypeRequirement(unitType2);
   5.375 -			req.AddUnitTypeRequirement(unitType3);
   5.376 -			Assert.That(req.GetAllowsAddingMessage(unitType3, army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " (would have 0)."));
   5.377 +			Assert_That__ValidationPasses(req, army);
   5.378 +		}
   5.379 +
   5.380 +		[Test()]
   5.381 +		public void TestAddingUnitTypeMakesRequirementPassValidating()
   5.382 +		{
   5.383 +			Army army = new Army(mockRace, "Test", 1000);
   5.384 +			AddUnitOfTypeToArmy(unitType1, army);
   5.385 +			AddUnitOfTypeToArmy(unitType2, army);
   5.386 +			UnitRequiresAtLeastNUnitsRequirement req = new UnitRequiresAtLeastNUnitsRequirement(unitType1);
   5.387 +			req.AddUnitTypeRequirement(unitType2, 2);
   5.388 +			Assert_That__ValidationFails(req, army, "Army must contain: 2 × " + unitType2.Name + " (have 1).");
   5.389 +			AddUnitOfTypeToArmy(unitType2, army);
   5.390 +			Assert_That__ValidationPasses(req, army);
   5.391  		}
   5.392  	}
   5.393  }
     6.1 --- a/API/Objects/Requirement/UnitRequiresNUnitsForMUnitsRequirementTests.cs	Sun Feb 26 15:38:13 2012 +0000
     6.2 +++ b/API/Objects/Requirement/UnitRequiresNUnitsForMUnitsRequirementTests.cs	Sun Feb 26 20:18:45 2012 +0000
     6.3 @@ -29,16 +29,6 @@
     6.4  		}
     6.5  
     6.6  		[Test()]
     6.7 -		public void TestAddingUnitWithNoUnitsAndOneUnitTypeRequiredFails()
     6.8 -		{
     6.9 -			Army army = new Army(mockRace, "Test", 1000);
    6.10 -			Unit unit = CreateUnitOfType(unitType1, army);
    6.11 -			UnitRequiresNUnitsForMUnitsRequirement req = new UnitRequiresNUnitsForMUnitsRequirement(unitType1);
    6.12 -			req.AddUnitTypeRequirement(unitType2);
    6.13 -			Assert_That__FailsAdding(req, unit, army, "Army must contain: 1 × " + unitType2.Name + " for every 1 × " + unitType1.Name + " (would have 0 for 1).");
    6.14 -		}
    6.15 -
    6.16 -		[Test()]
    6.17  		public void TestAddingUnitTypeWithNoUnitsAndOneUnitTypeRequiredFails()
    6.18  		{
    6.19  			Army army = new Army(mockRace, "Test", 1000);
    6.20 @@ -48,17 +38,6 @@
    6.21  		}
    6.22  
    6.23  		[Test()]
    6.24 -		public void TestAddingUnitWithOneUnitAndOneUnitTypeRequiredPasses()
    6.25 -		{
    6.26 -			Army army = new Army(mockRace, "Test", 1000);
    6.27 -			AddUnitOfTypeToArmy(unitType2, army);
    6.28 -			Unit unit = CreateUnitOfType(unitType1, army);
    6.29 -			UnitRequiresNUnitsForMUnitsRequirement req = new UnitRequiresNUnitsForMUnitsRequirement(unitType1);
    6.30 -			req.AddUnitTypeRequirement(unitType2);
    6.31 -			Assert_That__PassesAdding(req, unit, army);
    6.32 -		}
    6.33 -
    6.34 -		[Test()]
    6.35  		public void TestAddingUnitTypeWithOneUnitAndOneUnitTypeRequiredPasses()
    6.36  		{
    6.37  			Army army = new Army(mockRace, "Test", 1000);
    6.38 @@ -69,17 +48,6 @@
    6.39  		}
    6.40  
    6.41  		[Test()]
    6.42 -		public void TestAddingUnitWithOneUnitAndOneUnitTypeRequiredPassesWhenAddingRequiredUnit()
    6.43 -		{
    6.44 -			Army army = new Army(mockRace, "Test", 1000);
    6.45 -			AddUnitOfTypeToArmy(unitType1, army);
    6.46 -			Unit unit = CreateUnitOfType(unitType2, army);
    6.47 -			UnitRequiresNUnitsForMUnitsRequirement req = new UnitRequiresNUnitsForMUnitsRequirement(unitType1);
    6.48 -			req.AddUnitTypeRequirement(unitType2);
    6.49 -			Assert_That__PassesAdding(req, unit, army);
    6.50 -		}
    6.51 -
    6.52 -		[Test()]
    6.53  		public void TestAddingUnitTypeWithOneUnitAndOneUnitTypeRequiredPassesWhenAddingRequiredUnitType()
    6.54  		{
    6.55  			Army army = new Army(mockRace, "Test", 1000);
    6.56 @@ -151,9 +119,7 @@
    6.57  			UnitRequiresNUnitsForMUnitsRequirement req = new UnitRequiresNUnitsForMUnitsRequirement(unitType1);
    6.58  			req.AddUnitTypeRequirement(unitType2);
    6.59  			Assert_That__AddingNotApplicable(req, unitType3, army);
    6.60 -			Assert_That__AddingNotApplicable(req, CreateUnitOfType(unitType3, army), army);
    6.61  			Assert_That__AddingNotApplicable(req, unitType2, army);
    6.62 -			Assert_That__AddingNotApplicable(req, CreateUnitOfType(unitType2, army), army);
    6.63  		}
    6.64  
    6.65  		[Test]
     7.1 --- a/API/Objects/Requirement/UnitRequiresNoMoreThanNOfUnitTypeRequirementTest.cs	Sun Feb 26 15:38:13 2012 +0000
     7.2 +++ b/API/Objects/Requirement/UnitRequiresNoMoreThanNOfUnitTypeRequirementTest.cs	Sun Feb 26 20:18:45 2012 +0000
     7.3 @@ -29,16 +29,6 @@
     7.4  		}
     7.5  
     7.6  		[Test()]
     7.7 -		public void TestAddingUnitWithNoUnitsAndOneUnitTypeRequiredIsAllowed()
     7.8 -		{
     7.9 -			Army army = new Army(mockRace, "Test", 1000);
    7.10 -			Unit unit = CreateUnitOfType(unitType1, army);
    7.11 -			UnitRequiresNoMoreThanNOfUnitTypeRequirement req = new UnitRequiresNoMoreThanNOfUnitTypeRequirement(unitType1);
    7.12 -			req.AddUnitTypeRequirement(unitType2);
    7.13 -			Assert_That__PassesAdding(req, unit, army);
    7.14 -		}
    7.15 -
    7.16 -		[Test()]
    7.17  		public void TestAddingUnitTypeWithNoUnitsAndOneUnitTypeRequiredIsAllowed()
    7.18  		{
    7.19  			Army army = new Army(mockRace, "Test", 1000);
    7.20 @@ -48,17 +38,6 @@
    7.21  		}
    7.22  
    7.23  		[Test()]
    7.24 -		public void TestAddingUnitWithOneUnitAndOneUnitTypeRequiredIsNotAllowed()
    7.25 -		{
    7.26 -			Army army = new Army(mockRace, "Test", 1000);
    7.27 -			AddUnitOfTypeToArmy(unitType2, army);
    7.28 -			Unit unit = CreateUnitOfType(unitType1, army);
    7.29 -			UnitRequiresNoMoreThanNOfUnitTypeRequirement req = new UnitRequiresNoMoreThanNOfUnitTypeRequirement(unitType1);
    7.30 -			req.AddUnitTypeRequirement(unitType2);
    7.31 -			Assert_That__FailsAdding(req, unit, army, "Army cannot contain more than: 0 × " + unitType2.Name + " (would have 1).");
    7.32 -		}
    7.33 -
    7.34 -		[Test()]
    7.35  		public void TestAddingUnitTypeWithOneUnitAndOneUnitTypeRequiredIsNotAllowed()
    7.36  		{
    7.37  			Army army = new Army(mockRace, "Test", 1000);
    7.38 @@ -119,9 +98,7 @@
    7.39  			UnitRequiresNoMoreThanNOfUnitTypeRequirement req = new UnitRequiresNoMoreThanNOfUnitTypeRequirement(unitType1);
    7.40  			req.AddUnitTypeRequirement(unitType2);
    7.41  			Assert_That__AddingNotApplicable(req, unitType3, army);
    7.42 -			Assert_That__AddingNotApplicable(req, CreateUnitOfType(unitType3, army), army);
    7.43  			Assert_That__AddingNotApplicable(req, unitType2, army);
    7.44 -			Assert_That__AddingNotApplicable(req, CreateUnitOfType(unitType2, army), army);
    7.45  		}
    7.46  
    7.47  		[Test]
     8.1 --- a/IBBoard.WarFoundry.API.Tests.csproj	Sun Feb 26 15:38:13 2012 +0000
     8.2 +++ b/IBBoard.WarFoundry.API.Tests.csproj	Sun Feb 26 20:18:45 2012 +0000
     8.3 @@ -89,11 +89,9 @@
     8.4      <Compile Include="API\Factories\Xml\WarFoundryXmlFactoryTests.cs" />
     8.5      <Compile Include="API\EventListeningWarFoundryLoader.cs" />
     8.6      <Compile Include="API\Savers\IWarFoundryFileSaverTests.cs" />
     8.7 -    <Compile Include="API\Objects\Requirement\RequiresAtLeastNUnitsRequirementTest.cs" />
     8.8      <Compile Include="API\Objects\Requirement\UnitRequiresAtLeastNUnitsRequirementTest.cs" />
     8.9      <Compile Include="API\Objects\Requirement\ValidationTests.cs" />
    8.10      <Compile Include="API\Objects\Requirement\UnitRequiresNoMoreThanNOfUnitTypeRequirementTest.cs" />
    8.11 -    <Compile Include="API\Objects\Requirement\RequiresNoMoreThanNOfUnitTypeRequirementTest.cs" />
    8.12      <Compile Include="API\Objects\RaceTests.cs" />
    8.13      <Compile Include="API\Objects\Requirement\RequirementHandlerTests.cs" />
    8.14      <Compile Include="API\Objects\Requirement\Mock\FailingRequirement.cs" />
    8.15 @@ -117,7 +115,6 @@
    8.16      <Compile Include="API\Factories\Mock\FileSearchingWarFoundryFactory.cs" />
    8.17      <Compile Include="API\Objects\ArmyTests.cs" />
    8.18      <Compile Include="API\Objects\Requirement\UnitRequiresNUnitsForMUnitsRequirementTests.cs" />
    8.19 -    <Compile Include="API\Objects\Requirement\RequiresNUnitsForMObjectsRequirementTest.cs" />
    8.20      <Compile Include="API\Objects\Requirement\Mock\MockRequiresNUnitsForMObjectsRequirement.cs" />
    8.21      <Compile Include="API\Objects\Requirement\AbstractUnitRequirementTest.cs" />
    8.22    </ItemGroup>