changeset 224:49480e1a8f90

Re #359: Add "only contained" attribute to unit types * Add tests to make sure contained units aren't returned in list for category
author IBBoard <dev@ibboard.co.uk>
date Sat, 14 Apr 2012 16:58:20 +0100
parents fd51527f6d64
children c6313a2c08a2
files API/Objects/RaceTests.cs IBBoard.WarFoundry.API.Tests.csproj
diffstat 2 files changed, 14 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/API/Objects/RaceTests.cs	Sat Mar 31 20:17:44 2012 +0100
+++ b/API/Objects/RaceTests.cs	Sat Apr 14 16:58:20 2012 +0100
@@ -62,6 +62,19 @@
 			Assert.That(raceRequirements, Has.Member(unitRequirement1));
 			Assert.That(raceRequirements, Has.Member(unitRequirement2));
 			Assert.That(raceRequirements, Has.Member(unitRequirement3));
+		}
+
+		[Test()]
+		public void TestContainedOnlyUnitsAreNotReturned()
+		{
+			MockRace race = new MockRace();
+			MockUnitType unitType1 = new MockUnitType("type1", "Type 1");
+			race.AddUnitType(unitType1);
+			MockContainedUnitType unitType2 = new MockContainedUnitType("type2", "Type 2");
+			race.AddUnitType(unitType2);
+			unitType1.AddContainedUnitType(unitType2);
+			Assert.That(race.GetUnitTypes(MockCategory.GetCategory()), Has.Length(1));
+			Assert.That(race.GetUnitTypes(MockCategory.GetCategory()), Has.Member(unitType1));
 		}
 
 		public override Race GetObject ()
--- a/IBBoard.WarFoundry.API.Tests.csproj	Sat Mar 31 20:17:44 2012 +0100
+++ b/IBBoard.WarFoundry.API.Tests.csproj	Sat Apr 14 16:58:20 2012 +0100
@@ -121,6 +121,7 @@
     <Compile Include="API\Objects\Requirement\RaceRequiresNoMoreThanNUnitsRequirementTest.cs" />
     <Compile Include="API\Objects\Requirement\AbstractUnitTypeUnitRequirementTest.cs" />
     <Compile Include="API\Objects\Requirement\AbstractRaceUnitRequirementTest.cs" />
+    <Compile Include="API\Objects\Mock\MockContainedUnitType.cs" />
   </ItemGroup>
   <ItemGroup>
     <None Include="app.config" />