changeset 138:11faab6c712a

Re #140: Add equality methods * Add equality method tests for RequiresAtLeastNUnitsRequirement
author IBBoard <dev@ibboard.co.uk>
date Tue, 26 Apr 2011 19:14:34 +0000
parents 081b48413f6d
children 3e4864e206ea
files API/Objects/Requirement/RequiresAtLeastNUnitsRequirementTest.cs
diffstat 1 files changed, 223 insertions(+), 151 deletions(-) [+]
line diff
     1.1 --- a/API/Objects/Requirement/RequiresAtLeastNUnitsRequirementTest.cs	Tue Apr 26 15:03:46 2011 +0000
     1.2 +++ b/API/Objects/Requirement/RequiresAtLeastNUnitsRequirementTest.cs	Tue Apr 26 19:14:34 2011 +0000
     1.3 @@ -1,179 +1,251 @@
     1.4 -// This file (UnitRequiresAtLeastNUnitsRequirement.cs) is a part of the IBBoard.WarFoundry.API.Tests project and is copyright 2011 IBBoard
     1.5 +// This file (UnitRequiresAtLeastNUnitsRequirement.cs) is a part of the IBBoard.WarFoundry.API.Tests project and is copyright 2011 IBBoard
     1.6  // 
     1.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.
     1.8  using System;
     1.9 -using NUnit.Framework;
    1.10 -using IBBoard.WarFoundry.API.Objects.Mock;
    1.11 +using NUnit.Framework;
    1.12 +using IBBoard.WarFoundry.API.Objects.Mock;
    1.13  using NUnit.Framework.SyntaxHelpers;
    1.14 +using System.Reflection;
    1.15 +using IBBoard.NUnit;
    1.16 +using IBBoard.WarFoundry.API.Factories;
    1.17  
    1.18  namespace IBBoard.WarFoundry.API.Objects.Requirement
    1.19  {
    1.20  	[TestFixture()]
    1.21 -	public class RequiresAtLeastNUnitsRequirementTest
    1.22 -	{
    1.23 -		private MockRace mockRace;
    1.24 -		private UnitType unitType1;
    1.25 -		private UnitType unitType2;
    1.26 -		private UnitType unitType3;
    1.27 -
    1.28 -		[TestFixtureSetUp()]
    1.29 -		public void SetupRace()
    1.30 -		{
    1.31 -			mockRace = MockRace.GetMockRace();
    1.32 -			unitType1 = new MockUnitType("type1", "Unit Type 1");
    1.33 -			mockRace.AddUnitType(unitType1);
    1.34 -			unitType2 = new MockUnitType("type2", "Unit Type 2");
    1.35 -			mockRace.AddUnitType(unitType2);
    1.36 -			unitType3 = new MockUnitType("type3", "Unit Type 3");
    1.37 -			mockRace.AddUnitType(unitType3);
    1.38 -		}
    1.39 +	public class RequiresAtLeastNUnitsRequirementTest : AbstractEqualityTest<RequiresAtLeastNUnitsRequirement>
    1.40 +	{
    1.41 +		//FIXME We shouldn't duplicate these tests, but it is broken at the moment
    1.42 +		[Test]
    1.43 +		public void TestEquality()
    1.44 +		{
    1.45 +			Assert.AreEqual(GetObject(), GetSameObject());
    1.46 +			Assert.AreEqual(GetSameObject(), GetObject());
    1.47 +		}
    1.48 +
    1.49 +		[Test]
    1.50 +		public void TestInequality()
    1.51 +		{
    1.52 +			Assert.AreNotEqual(GetObject(), GetDifferentObject());
    1.53 +			Assert.AreNotEqual(GetSameObject(), GetDifferentObject());
    1.54 +			Assert.AreNotEqual(GetDifferentObject(), GetObject());
    1.55 +			Assert.AreNotEqual(GetDifferentObject(), GetSameObject());
    1.56 +		}
    1.57 +
    1.58 +		[Test]
    1.59 +		public void TestReflexiveEquality()
    1.60 +		{
    1.61 +			Assert.AreEqual(GetObject(), GetObject());
    1.62 +			Assert.AreEqual(GetSameObject(), GetSameObject());
    1.63 +			Assert.AreEqual(GetDifferentObject(), GetDifferentObject());
    1.64 +		}
    1.65 +
    1.66 +		[Test]
    1.67 +		public void TestOtherInequality()
    1.68 +		{
    1.69 +			MethodInfo[] methodInfo = GetType().GetMethods();
    1.70 +			RequiresAtLeastNUnitsRequirement obj = GetObject();
    1.71 +
    1.72 +			foreach (MethodInfo method in methodInfo)
    1.73 +			{
    1.74 +				if (method.Name.StartsWith("GetOtherDifferent"))
    1.75 +				{
    1.76 +					RequiresAtLeastNUnitsRequirement otherObj = (RequiresAtLeastNUnitsRequirement)method.Invoke(this, new object[0]);
    1.77 +					Assert.AreNotEqual(obj, otherObj, "Objects equal for "+method.Name);
    1.78 +					Assert.AreNotEqual(otherObj, obj, "Objects equal for "+method.Name);
    1.79 +				}
    1.80 +			}
    1.81 +		}
    1.82 +
    1.83 +
    1.84 +
    1.85 +
    1.86 +		private MockRace mockRace;
    1.87 +		private UnitType unitType1;
    1.88 +		private UnitType unitType2;
    1.89 +		private UnitType unitType3;
    1.90 +
    1.91 +		[TestFixtureSetUp()]
    1.92 +		public void SetupRace()
    1.93 +		{
    1.94 +			mockRace = MockRace.GetMockRace();
    1.95 +			unitType1 = new MockUnitType("type1", "Unit Type 1");
    1.96 +			mockRace.AddUnitType(unitType1);
    1.97 +			unitType2 = new MockUnitType("type2", "Unit Type 2");
    1.98 +			mockRace.AddUnitType(unitType2);
    1.99 +			unitType3 = new MockUnitType("type3", "Unit Type 3");
   1.100 +			mockRace.AddUnitType(unitType3);
   1.101 +		}
   1.102  
   1.103  		[Test()]
   1.104  		public void TestAddingUnrelatedUnitWithNoUnitsAndOneUnitTypeRequired()
   1.105 -		{
   1.106 -			Army army = new Army(mockRace, "Test", 1000);
   1.107 -			Unit unit = CreateUnitOfType(unitType1, army);
   1.108 -			RequiresAtLeastNUnitsRequirement req = new RequiresAtLeastNUnitsRequirement(unitType2);
   1.109 +		{
   1.110 +			Army army = new Army(mockRace, "Test", 1000);
   1.111 +			Unit unit = CreateUnitOfType(unitType1, army);
   1.112 +			RequiresAtLeastNUnitsRequirement req = new RequiresAtLeastNUnitsRequirement(unitType2);
   1.113  			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.NotApplicable));
   1.114 +		}
   1.115 +
   1.116 +		[Test()]
   1.117 +		public void TestAddingOneUnitWithOneUnitTypeRequired()
   1.118 +		{
   1.119 +			Army army = new Army(mockRace, "Test", 1000);
   1.120 +			Unit unit = CreateUnitOfType(unitType1, army);
   1.121 +			RequiresAtLeastNUnitsRequirement req = new RequiresAtLeastNUnitsRequirement(unitType1);
   1.122 +			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Passed));
   1.123 +		}
   1.124 +
   1.125 +		[Test()]
   1.126 +		public void TestAddingUnitWithOneUnitAndTwoOfUnitTypeRequired()
   1.127 +		{
   1.128 +			Army army = new Army(mockRace, "Test", 1000);
   1.129 +			RequiresAtLeastNUnitsRequirement req = new RequiresAtLeastNUnitsRequirement();
   1.130 +			req.AddUnitTypeRequirement(unitType1, 2);
   1.131 +			AddUnitOfTypeToArmy(unitType1, army);
   1.132 +			Unit unit = CreateUnitOfType(unitType1, army);
   1.133 +			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Passed));
   1.134 +		}
   1.135 +
   1.136 +		[Test()]
   1.137 +		public void TestAddingUnrelatedUnitTypeWithNoUnitsAndOneUnitTypeRequired()
   1.138 +		{
   1.139 +			Army army = new Army(mockRace, "Test", 1000);
   1.140 +			RequiresAtLeastNUnitsRequirement req = new RequiresAtLeastNUnitsRequirement(unitType2);
   1.141 +			Assert.That(req.AllowsAdding(unitType1, army), Is.EqualTo(Validation.NotApplicable));
   1.142 +		}
   1.143 +
   1.144 +		[Test()]
   1.145 +		public void TestAddingUnitTypeWithNoUnitsAndOneUnitTypeRequired()
   1.146 +		{
   1.147 +			Army army = new Army(mockRace, "Test", 1000);
   1.148 +			RequiresAtLeastNUnitsRequirement req = new RequiresAtLeastNUnitsRequirement(unitType1);
   1.149 +			Assert.That(req.AllowsAdding(unitType1, army), Is.EqualTo(Validation.Passed));
   1.150 +		}
   1.151 +
   1.152 +		[Test()]
   1.153 +		public void TestAddingUnitTypeWithOneUnitAndOneUnitTypeRequired()
   1.154 +		{
   1.155 +			Army army = new Army(mockRace, "Test", 1000);
   1.156 +			AddUnitOfTypeToArmy(unitType1, army);
   1.157 +			RequiresAtLeastNUnitsRequirement req = new RequiresAtLeastNUnitsRequirement(unitType1);
   1.158 +			Assert.That(req.AllowsAdding(unitType1, army), Is.EqualTo(Validation.Passed));
   1.159 +		}
   1.160 +
   1.161 +		[Test()]
   1.162 +		public void TestAddingUnitTypeWithNoUnitsAndTwoUnitTypesRequired()
   1.163 +		{
   1.164 +			Army army = new Army(mockRace, "Test", 1000);
   1.165 +			RequiresAtLeastNUnitsRequirement req = new RequiresAtLeastNUnitsRequirement(unitType2, unitType3);
   1.166 +			Assert.That(req.AllowsAdding(unitType2, army), Is.EqualTo(Validation.Failed));
   1.167 +		}
   1.168 +
   1.169 +		[Test()]
   1.170 +		public void TestAddingUnitTypeWithOneUnitAndTwoUnitTypesRequired()
   1.171 +		{
   1.172 +			Army army = new Army(mockRace, "Test", 1000);
   1.173 +			AddUnitOfTypeToArmy(unitType3, army);
   1.174 +			RequiresAtLeastNUnitsRequirement req = new RequiresAtLeastNUnitsRequirement(unitType2, unitType3);
   1.175 +			Assert.That(req.AllowsAdding(unitType2, army), Is.EqualTo(Validation.Passed));
   1.176 +		}
   1.177 +
   1.178 +		[Test()]
   1.179 +		public void TestAddingUnitTypeWithBothUnitsAndTwoUnitTypesRequired()
   1.180 +		{
   1.181 +			Army army = new Army(mockRace, "Test", 1000);
   1.182 +			AddUnitOfTypeToArmy(unitType2, army);
   1.183 +			AddUnitOfTypeToArmy(unitType3, army);
   1.184 +			RequiresAtLeastNUnitsRequirement req = new RequiresAtLeastNUnitsRequirement(unitType2, unitType3);
   1.185 +			Assert.That(req.AllowsAdding(unitType2, army), Is.EqualTo(Validation.Passed));
   1.186 +		}
   1.187 +
   1.188 +		[Test()]
   1.189 +		public void TestAddingOneOfUnitTypeWithTwoOfOneUnitTypeRequired()
   1.190 +		{
   1.191 +			Army army = new Army(mockRace, "Test", 1000);
   1.192 +			RequiresAtLeastNUnitsRequirement req = new RequiresAtLeastNUnitsRequirement();
   1.193 +			req.AddUnitTypeRequirement(unitType1, 2);
   1.194 +			Assert.That(req.AllowsAdding(unitType1, army), Is.EqualTo(Validation.Failed));
   1.195 +		}
   1.196 +
   1.197 +		[Test()]
   1.198 +		public void TestAddingOneUnitTypeWithOneUnitAndTwoOfOneUnitTypeRequired()
   1.199 +		{
   1.200 +			Army army = new Army(mockRace, "Test", 1000);
   1.201 +			AddUnitOfTypeToArmy(unitType1, army);
   1.202 +			RequiresAtLeastNUnitsRequirement req = new RequiresAtLeastNUnitsRequirement();
   1.203 +			req.AddUnitTypeRequirement(unitType1, 2);
   1.204 +			Assert.That(req.AllowsAdding(unitType1, army), Is.EqualTo(Validation.Passed));
   1.205 +		}
   1.206 +
   1.207 +		[Test()]
   1.208 +		public void TestAddingUnitTypeRequirementWithNoNumberDefaultsToHavingOne()
   1.209 +		{
   1.210 +			Army army = new Army(mockRace, "Test", 1000);
   1.211 +			RequiresAtLeastNUnitsRequirement req = new RequiresAtLeastNUnitsRequirement();
   1.212 +			req.AddUnitTypeRequirement(unitType1);
   1.213 +			Assert.That(req.AllowsAdding(unitType1, army), Is.EqualTo(Validation.Passed));
   1.214 +		}
   1.215 +
   1.216 +		[Test()]
   1.217 +		public void TestValidityOfArmyWithNoUnitsAndOneUnitTypeRequired()
   1.218 +		{
   1.219 +			Army army = new Army(mockRace, "Test", 1000);
   1.220 +			RequiresAtLeastNUnitsRequirement req = new RequiresAtLeastNUnitsRequirement(unitType1);
   1.221 +			Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Failed));
   1.222 +		}
   1.223 +
   1.224 +		[Test()]
   1.225 +		public void TestValidityOfArmyWithOneUnitAndOneUnitTypeRequired()
   1.226 +		{
   1.227 +			Army army = new Army(mockRace, "Test", 1000);
   1.228 +			AddUnitOfTypeToArmy(unitType1, army);
   1.229 +			RequiresAtLeastNUnitsRequirement req = new RequiresAtLeastNUnitsRequirement(unitType1);
   1.230 +			Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Passed));
   1.231 +		}
   1.232 +
   1.233 +		[Test]
   1.234 +		public void TestAddingMinNumberUnitTypePassesRequirement()
   1.235 +		{
   1.236 +			Army army = new Army(mockRace, "Test", 1000);
   1.237 +			RequiresAtLeastNUnitsRequirement req = new RequiresAtLeastNUnitsRequirement();
   1.238 +			req.AddUnitTypeRequirement(unitType1, 2);
   1.239 +			Assert.That(req.AllowsAdding(unitType1, army), Is.EqualTo(Validation.Failed));
   1.240 +			AddUnitOfTypeToArmy(unitType1, army);
   1.241 +			Assert.That(req.AllowsAdding(unitType1, army), Is.EqualTo(Validation.Passed));
   1.242 +		}
   1.243 +
   1.244 +		private static void AddUnitOfTypeToArmy(UnitType unitType, Army army)
   1.245 +		{
   1.246 +			army.AddUnit(CreateUnitOfType(unitType, army));
   1.247 +		}
   1.248 +
   1.249 +		private static Unit CreateUnitOfType(UnitType unitType, Army army)
   1.250 +		{
   1.251 +			return new Unit(unitType, army.GetCategory(unitType.MainCategory));
   1.252  		}
   1.253  
   1.254 -		[Test()]
   1.255 -		public void TestAddingOneUnitWithOneUnitTypeRequired()
   1.256 +		public override RequiresAtLeastNUnitsRequirement GetObject ()
   1.257  		{
   1.258 -			Army army = new Army(mockRace, "Test", 1000);
   1.259 -			Unit unit = CreateUnitOfType(unitType1, army);
   1.260 -			RequiresAtLeastNUnitsRequirement req = new RequiresAtLeastNUnitsRequirement(unitType1);
   1.261 -			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Passed));
   1.262 +			RequiresAtLeastNUnitsRequirement req = new RequiresAtLeastNUnitsRequirement();
   1.263 +			req.AddUnitTypeRequirement(unitType1, 2);
   1.264 +			return req;
   1.265  		}
   1.266  
   1.267 -		[Test()]
   1.268 -		public void TestAddingUnitWithOneUnitAndTwoOfUnitTypeRequired()
   1.269 +		public override RequiresAtLeastNUnitsRequirement GetSameObject ()
   1.270  		{
   1.271 -			Army army = new Army(mockRace, "Test", 1000);
   1.272  			RequiresAtLeastNUnitsRequirement req = new RequiresAtLeastNUnitsRequirement();
   1.273  			req.AddUnitTypeRequirement(unitType1, 2);
   1.274 -			AddUnitOfTypeToArmy(unitType1, army);
   1.275 -			Unit unit = CreateUnitOfType(unitType1, army);
   1.276 -			Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Passed));
   1.277 +			return req;
   1.278  		}
   1.279  
   1.280 -		[Test()]
   1.281 -		public void TestAddingUnrelatedUnitTypeWithNoUnitsAndOneUnitTypeRequired()
   1.282 +		public override RequiresAtLeastNUnitsRequirement GetDifferentObject ()
   1.283  		{
   1.284 -			Army army = new Army(mockRace, "Test", 1000);
   1.285 -			RequiresAtLeastNUnitsRequirement req = new RequiresAtLeastNUnitsRequirement(unitType2);
   1.286 -			Assert.That(req.AllowsAdding(unitType1, army), Is.EqualTo(Validation.NotApplicable));
   1.287 -		}
   1.288 -
   1.289 -		[Test()]
   1.290 -		public void TestAddingUnitTypeWithNoUnitsAndOneUnitTypeRequired()
   1.291 -		{
   1.292 -			Army army = new Army(mockRace, "Test", 1000);
   1.293 -			RequiresAtLeastNUnitsRequirement req = new RequiresAtLeastNUnitsRequirement(unitType1);
   1.294 -			Assert.That(req.AllowsAdding(unitType1, army), Is.EqualTo(Validation.Passed));
   1.295 -		}
   1.296 -
   1.297 -		[Test()]
   1.298 -		public void TestAddingUnitTypeWithOneUnitAndOneUnitTypeRequired()
   1.299 -		{
   1.300 -			Army army = new Army(mockRace, "Test", 1000);
   1.301 -			AddUnitOfTypeToArmy(unitType1, army);
   1.302 -			RequiresAtLeastNUnitsRequirement req = new RequiresAtLeastNUnitsRequirement(unitType1);
   1.303 -			Assert.That(req.AllowsAdding(unitType1, army), Is.EqualTo(Validation.Passed));
   1.304 -		}
   1.305 -
   1.306 -		[Test()]
   1.307 -		public void TestAddingUnitTypeWithNoUnitsAndTwoUnitTypesRequired()
   1.308 -		{
   1.309 -			Army army = new Army(mockRace, "Test", 1000);
   1.310 -			RequiresAtLeastNUnitsRequirement req = new RequiresAtLeastNUnitsRequirement(unitType2, unitType3);
   1.311 -			Assert.That(req.AllowsAdding(unitType2, army), Is.EqualTo(Validation.Failed));
   1.312 -		}
   1.313 -
   1.314 -		[Test()]
   1.315 -		public void TestAddingUnitTypeWithOneUnitAndTwoUnitTypesRequired()
   1.316 -		{
   1.317 -			Army army = new Army(mockRace, "Test", 1000);
   1.318 -			AddUnitOfTypeToArmy(unitType3, army);
   1.319 -			RequiresAtLeastNUnitsRequirement req = new RequiresAtLeastNUnitsRequirement(unitType2, unitType3);
   1.320 -			Assert.That(req.AllowsAdding(unitType2, army), Is.EqualTo(Validation.Passed));
   1.321 -		}
   1.322 -
   1.323 -		[Test()]
   1.324 -		public void TestAddingUnitTypeWithBothUnitsAndTwoUnitTypesRequired()
   1.325 -		{
   1.326 -			Army army = new Army(mockRace, "Test", 1000);
   1.327 -			AddUnitOfTypeToArmy(unitType2, army);
   1.328 -			AddUnitOfTypeToArmy(unitType3, army);
   1.329 -			RequiresAtLeastNUnitsRequirement req = new RequiresAtLeastNUnitsRequirement(unitType2, unitType3);
   1.330 -			Assert.That(req.AllowsAdding(unitType2, army), Is.EqualTo(Validation.Passed));
   1.331 -		}
   1.332 -
   1.333 -		[Test()]
   1.334 -		public void TestAddingOneOfUnitTypeWithTwoOfOneUnitTypeRequired()
   1.335 -		{
   1.336 -			Army army = new Army(mockRace, "Test", 1000);
   1.337  			RequiresAtLeastNUnitsRequirement req = new RequiresAtLeastNUnitsRequirement();
   1.338 -			req.AddUnitTypeRequirement(unitType1, 2);
   1.339 -			Assert.That(req.AllowsAdding(unitType1, army), Is.EqualTo(Validation.Failed));
   1.340 -		}
   1.341 -
   1.342 -		[Test()]
   1.343 -		public void TestAddingOneUnitTypeWithOneUnitAndTwoOfOneUnitTypeRequired()
   1.344 -		{
   1.345 -			Army army = new Army(mockRace, "Test", 1000);
   1.346 -			AddUnitOfTypeToArmy(unitType1, army);
   1.347 -			RequiresAtLeastNUnitsRequirement req = new RequiresAtLeastNUnitsRequirement();
   1.348 -			req.AddUnitTypeRequirement(unitType1, 2);
   1.349 -			Assert.That(req.AllowsAdding(unitType1, army), Is.EqualTo(Validation.Passed));
   1.350 -		}
   1.351 -
   1.352 -		[Test()]
   1.353 -		public void TestAddingUnitTypeRequirementWithNoNumberDefaultsToHavingOne()
   1.354 -		{
   1.355 -			Army army = new Army(mockRace, "Test", 1000);
   1.356 -			RequiresAtLeastNUnitsRequirement req = new RequiresAtLeastNUnitsRequirement();
   1.357 -			req.AddUnitTypeRequirement(unitType1);
   1.358 -			Assert.That(req.AllowsAdding(unitType1, army), Is.EqualTo(Validation.Passed));
   1.359 -		}
   1.360 -
   1.361 -		[Test()]
   1.362 -		public void TestValidityOfArmyWithNoUnitsAndOneUnitTypeRequired()
   1.363 -		{
   1.364 -			Army army = new Army(mockRace, "Test", 1000);
   1.365 -			RequiresAtLeastNUnitsRequirement req = new RequiresAtLeastNUnitsRequirement(unitType1);
   1.366 -			Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Failed));
   1.367 -		}
   1.368 -
   1.369 -		[Test()]
   1.370 -		public void TestValidityOfArmyWithOneUnitAndOneUnitTypeRequired()
   1.371 -		{
   1.372 -			Army army = new Army(mockRace, "Test", 1000);
   1.373 -			AddUnitOfTypeToArmy(unitType1, army);
   1.374 -			RequiresAtLeastNUnitsRequirement req = new RequiresAtLeastNUnitsRequirement(unitType1);
   1.375 -			Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Passed));
   1.376 -		}
   1.377 -
   1.378 -		[Test]
   1.379 -		public void TestAddingMinNumberUnitTypePassesRequirement()
   1.380 -		{
   1.381 -			Army army = new Army(mockRace, "Test", 1000);
   1.382 -			RequiresAtLeastNUnitsRequirement req = new RequiresAtLeastNUnitsRequirement();
   1.383 -			req.AddUnitTypeRequirement(unitType1, 2);
   1.384 -			Assert.That(req.AllowsAdding(unitType1, army), Is.EqualTo(Validation.Failed));
   1.385 -			AddUnitOfTypeToArmy(unitType1, army);
   1.386 -			Assert.That(req.AllowsAdding(unitType1, army), Is.EqualTo(Validation.Passed));
   1.387 -		}
   1.388 -
   1.389 -		private static void AddUnitOfTypeToArmy(UnitType unitType, Army army)
   1.390 -		{
   1.391 -			army.AddUnit(CreateUnitOfType(unitType, army));
   1.392 +			DummyWarFoundryFactory factory = new DummyWarFoundryFactory();
   1.393 +			GameSystem gameSystem = new GameSystem("system", "system", factory);
   1.394 +			Race race = new Race("race", "race", gameSystem, factory);
   1.395 +			req.AddUnitTypeRequirement(new UnitType("id2", "Type 2", race), 2);
   1.396 +			return req;
   1.397  		}
   1.398 -
   1.399 -		private static Unit CreateUnitOfType(UnitType unitType, Army army)
   1.400 -		{
   1.401 -			return new Unit(unitType, army.GetCategory(unitType.MainCategory));
   1.402 -		}
   1.403  	}
   1.404  }
   1.405