changeset 63:a9163f8dfba1

Re #290: Migrate to using key/keyref definitions instead of ID/IDREF type * Move invalid equipment slot data file to sub-folder * Add test for valid equipment slot (currently null-refs and fails)
author IBBoard <dev@ibboard.co.uk>
date Sat, 03 Jul 2010 19:54:42 +0000
parents ef8950a5f4cb
children 6f638d6f400f
files API/Factories/Xml/WarFoundryXmlRaceFactoryTest.cs IBBoard.WarFoundry.API.Tests.csproj testdata/single-unit-with-invalid-equipment-slot-reference.racex testdata/xml-race-factory/single-unit-with-invalid-equipment-slot-reference.racex testdata/xml-race-factory/single-unit-with-valid-equipment-slot-reference.racex
diffstat 5 files changed, 76 insertions(+), 31 deletions(-) [+]
line diff
     1.1 --- a/API/Factories/Xml/WarFoundryXmlRaceFactoryTest.cs	Sat Jun 19 19:30:58 2010 +0000
     1.2 +++ b/API/Factories/Xml/WarFoundryXmlRaceFactoryTest.cs	Sat Jul 03 19:54:42 2010 +0000
     1.3 @@ -128,7 +128,7 @@
     1.4  		public void TestCompleteLoadingOnRaceWithIncorrectEquipmentSlotErrors()
     1.5  		{
     1.6  			SetDefaultGameSystem();
     1.7 -			FileInfo raceFile = new FileInfo("testdata/single-unit-with-invalid-equipment-slot-reference.racex");
     1.8 +			FileInfo raceFile = new FileInfo("testdata/xml-race-factory/single-unit-with-invalid-equipment-slot-reference.racex");
     1.9  			
    1.10  			try
    1.11  			{
    1.12 @@ -144,6 +144,17 @@
    1.13  		}
    1.14  
    1.15  		[Test()]
    1.16 +		public void TestCompleteLoadingOnRaceWithCorrectEquipmentSlotLoads()
    1.17 +		{
    1.18 +			SetDefaultGameSystem();
    1.19 +			FileInfo raceFile = new FileInfo("testdata/xml-race-factory/single-unit-with-valid-equipment-slot-reference.racex");
    1.20 +			Race race = SingleXmlObjectLoader.LoadRaceFromXML(WarFoundryXmlFactory.GetFactory(), raceFile);
    1.21 +			UnitType unitType = race.GetUnitType("General");
    1.22 +			UnitEquipmentItem unitEquipmentItem = unitType.GetEquipmentItem("equip1");
    1.23 +			Assert.That(unitEquipmentItem.SlotName, Is.EqualTo("slot1"));
    1.24 +		}
    1.25 +
    1.26 +		[Test()]
    1.27  		public void TestCompleteLoadingOnRaceWithIncorrectEquipmentIDError()
    1.28  		{
    1.29  			SetDefaultGameSystem();
     2.1 --- a/IBBoard.WarFoundry.API.Tests.csproj	Sat Jun 19 19:30:58 2010 +0000
     2.2 +++ b/IBBoard.WarFoundry.API.Tests.csproj	Sat Jul 03 19:54:42 2010 +0000
     2.3 @@ -143,9 +143,6 @@
     2.4      <None Include="WarFoundryTests.nunit">
     2.5        <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     2.6      </None>
     2.7 -    <None Include="testdata\single-unit-with-invalid-equipment-slot-reference.racex">
     2.8 -      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     2.9 -    </None>
    2.10      <None Include="testdata\invalid-contained-unit-reference.racex">
    2.11        <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    2.12      </None>
    2.13 @@ -176,6 +173,12 @@
    2.14      <None Include="testdata\xml-race-factory\existing-member-type.racex">
    2.15        <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    2.16      </None>
    2.17 +    <None Include="testdata\xml-race-factory\single-unit-with-invalid-equipment-slot-reference.racex">
    2.18 +      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    2.19 +    </None>
    2.20 +    <None Include="testdata\xml-race-factory\single-unit-with-valid-equipment-slot-reference.racex">
    2.21 +      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    2.22 +    </None>
    2.23    </ItemGroup>
    2.24    <ItemGroup>
    2.25      <Reference Include="ICSharpCode.SharpZipLib, Version=0.85.5.452, Culture=neutral, PublicKeyToken=1b03e6acf1164f73">
     3.1 --- a/testdata/single-unit-with-invalid-equipment-slot-reference.racex	Sat Jun 19 19:30:58 2010 +0000
     3.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.3 @@ -1,27 +0,0 @@
     3.4 -<?xml version="1.0" encoding="UTF-8"?>
     3.5 -<race xmlns="http://ibboard.co.uk/warfoundry/race" xmlns:core="http://ibboard.co.uk/warfoundry/core" id="Empire" name="Empire" system="nonexistant">
     3.6 -	<units>
     3.7 -		<unit id="Empire1" typeName="Empire General" cat="cat1" points="100" maxNum="1" maxSize="1">
     3.8 -			<stats>
     3.9 -				<stat name="M">4</stat>
    3.10 -				<stat name="WS">6</stat>
    3.11 -				<stat name="BS">6</stat>
    3.12 -				<stat name="S">4</stat>
    3.13 -				<stat name="T">4</stat>
    3.14 -				<stat name="W">3</stat>
    3.15 -				<stat name="I">6</stat>
    3.16 -				<stat name="A">4</stat>
    3.17 -				<stat name="Ld">9</stat>
    3.18 -			</stats>
    3.19 -			<equipmentSlots>
    3.20 -				<equipmentSlot name="slot1"/>
    3.21 -			</equipmentSlots>
    3.22 -			<unitEquipment>
    3.23 -				<unitEquipmentItem id="equip1" equipmentSlot="slot2"/>
    3.24 -			</unitEquipment>
    3.25 -		</unit>
    3.26 -	</units>
    3.27 -	<equipment>
    3.28 -		<equipmentItem id="equip1" name="sword" cost="1"/>
    3.29 -	</equipment>
    3.30 -</race>
    3.31 \ No newline at end of file
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/testdata/xml-race-factory/single-unit-with-invalid-equipment-slot-reference.racex	Sat Jul 03 19:54:42 2010 +0000
     4.3 @@ -0,0 +1,27 @@
     4.4 +<?xml version="1.0" encoding="UTF-8"?>
     4.5 +<race xmlns="http://ibboard.co.uk/warfoundry/race" xmlns:core="http://ibboard.co.uk/warfoundry/core" id="Empire" name="Empire" system="nonexistant">
     4.6 +	<units>
     4.7 +		<unit id="Empire1" typeName="Empire General" cat="cat1" points="100" maxNum="1" maxSize="1">
     4.8 +			<stats>
     4.9 +				<stat name="M">4</stat>
    4.10 +				<stat name="WS">6</stat>
    4.11 +				<stat name="BS">6</stat>
    4.12 +				<stat name="S">4</stat>
    4.13 +				<stat name="T">4</stat>
    4.14 +				<stat name="W">3</stat>
    4.15 +				<stat name="I">6</stat>
    4.16 +				<stat name="A">4</stat>
    4.17 +				<stat name="Ld">9</stat>
    4.18 +			</stats>
    4.19 +			<equipmentSlots>
    4.20 +				<equipmentSlot name="slot1"/>
    4.21 +			</equipmentSlots>
    4.22 +			<unitEquipment>
    4.23 +				<unitEquipmentItem id="equip1" equipmentSlot="slot2"/>
    4.24 +			</unitEquipment>
    4.25 +		</unit>
    4.26 +	</units>
    4.27 +	<equipment>
    4.28 +		<equipmentItem id="equip1" name="sword" cost="1"/>
    4.29 +	</equipment>
    4.30 +</race>
    4.31 \ No newline at end of file
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/testdata/xml-race-factory/single-unit-with-valid-equipment-slot-reference.racex	Sat Jul 03 19:54:42 2010 +0000
     5.3 @@ -0,0 +1,31 @@
     5.4 +<?xml version="1.0" encoding="UTF-8"?>
     5.5 +<race xmlns="http://ibboard.co.uk/warfoundry/race" xmlns:core="http://ibboard.co.uk/warfoundry/core" id="Empire" name="Empire" system="nonexistant">
     5.6 +	<units>
     5.7 +		<unit id="Empire1" typeName="Empire General" cat="cat1" points="100" maxNum="1" maxSize="1">
     5.8 +			<stats>
     5.9 +				<stat name="M">4</stat>
    5.10 +				<stat name="WS">6</stat>
    5.11 +				<stat name="BS">6</stat>
    5.12 +				<stat name="S">4</stat>
    5.13 +				<stat name="T">4</stat>
    5.14 +				<stat name="W">3</stat>
    5.15 +				<stat name="I">6</stat>
    5.16 +				<stat name="A">4</stat>
    5.17 +				<stat name="Ld">9</stat>
    5.18 +			</stats>
    5.19 +			<equipmentSlots>
    5.20 +				<equipmentSlot name="slot1">
    5.21 +					<maxLimit>
    5.22 +						<core:absoluteLimit limit="1" />
    5.23 +					</maxLimit>
    5.24 +				</equipmentSlot>
    5.25 +			</equipmentSlots>
    5.26 +			<unitEquipment>
    5.27 +				<unitEquipmentItem id="equip1" equipmentSlot="slot1"/>
    5.28 +			</unitEquipment>
    5.29 +		</unit>
    5.30 +	</units>
    5.31 +	<equipment>
    5.32 +		<equipmentItem id="equip1" name="sword" cost="1"/>
    5.33 +	</equipment>
    5.34 +</race>
    5.35 \ No newline at end of file