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 diff
     1.1 --- a/API/Objects/RaceTests.cs	Sat Mar 31 20:17:44 2012 +0100
     1.2 +++ b/API/Objects/RaceTests.cs	Sat Apr 14 16:58:20 2012 +0100
     1.3 @@ -62,6 +62,19 @@
     1.4  			Assert.That(raceRequirements, Has.Member(unitRequirement1));
     1.5  			Assert.That(raceRequirements, Has.Member(unitRequirement2));
     1.6  			Assert.That(raceRequirements, Has.Member(unitRequirement3));
     1.7 +		}
     1.8 +
     1.9 +		[Test()]
    1.10 +		public void TestContainedOnlyUnitsAreNotReturned()
    1.11 +		{
    1.12 +			MockRace race = new MockRace();
    1.13 +			MockUnitType unitType1 = new MockUnitType("type1", "Type 1");
    1.14 +			race.AddUnitType(unitType1);
    1.15 +			MockContainedUnitType unitType2 = new MockContainedUnitType("type2", "Type 2");
    1.16 +			race.AddUnitType(unitType2);
    1.17 +			unitType1.AddContainedUnitType(unitType2);
    1.18 +			Assert.That(race.GetUnitTypes(MockCategory.GetCategory()), Has.Length(1));
    1.19 +			Assert.That(race.GetUnitTypes(MockCategory.GetCategory()), Has.Member(unitType1));
    1.20  		}
    1.21  
    1.22  		public override Race GetObject ()
     2.1 --- a/IBBoard.WarFoundry.API.Tests.csproj	Sat Mar 31 20:17:44 2012 +0100
     2.2 +++ b/IBBoard.WarFoundry.API.Tests.csproj	Sat Apr 14 16:58:20 2012 +0100
     2.3 @@ -121,6 +121,7 @@
     2.4      <Compile Include="API\Objects\Requirement\RaceRequiresNoMoreThanNUnitsRequirementTest.cs" />
     2.5      <Compile Include="API\Objects\Requirement\AbstractUnitTypeUnitRequirementTest.cs" />
     2.6      <Compile Include="API\Objects\Requirement\AbstractRaceUnitRequirementTest.cs" />
     2.7 +    <Compile Include="API\Objects\Mock\MockContainedUnitType.cs" />
     2.8    </ItemGroup>
     2.9    <ItemGroup>
    2.10      <None Include="app.config" />