changeset 42:d4f6e9ac981e

Re #152: Test and fix extensibility of current schemas * Test system and army files * Test multiple unknown children in racex file
author IBBoard <dev@ibboard.co.uk>
date Sat, 13 Mar 2010 20:50:31 +0000
parents 9980a76e6a5e
children 00abd1c2f7d6
files API/Factories/Xml/WarFoundryXmlFactoryUtilTest.cs IBBoard.WarFoundry.API.Tests.csproj testdata/extended-data.armyx testdata/extended-data.racex testdata/extended-data.systemx
diffstat 5 files changed, 75 insertions(+), 3 deletions(-) [+]
line diff
     1.1 --- a/API/Factories/Xml/WarFoundryXmlFactoryUtilTest.cs	Sat Mar 13 16:47:03 2010 +0000
     1.2 +++ b/API/Factories/Xml/WarFoundryXmlFactoryUtilTest.cs	Sat Mar 13 20:50:31 2010 +0000
     1.3 @@ -4,6 +4,7 @@
     1.4  
     1.5  using System;
     1.6  using System.IO;
     1.7 +using System.Xml;
     1.8  using NUnit.Framework;
     1.9  
    1.10  namespace IBBoard.WarFoundry.API.Factories.Xml
    1.11 @@ -12,9 +13,17 @@
    1.12  	public class WarFoundryXmlFactoryUtilTest
    1.13  	{
    1.14  		[Test()]
    1.15 -		public void TestParsingExtendedDataFile()
    1.16 +		public void TestParsingExtendedDataFiles()
    1.17  		{
    1.18 -			WarFoundryXmlFactoryUtils.CreateXmlDocumentFromStream(new FileInfo("testdata/extended-data.racex").OpenRead());		
    1.19 +			TestParsingExtendedDataFile("testdata/extended-data.racex");
    1.20 +			TestParsingExtendedDataFile("testdata/extended-data.systemx");
    1.21 +			TestParsingExtendedDataFile("testdata/extended-data.armyx");
    1.22 +		}
    1.23 +		
    1.24 +		private static void TestParsingExtendedDataFile(string path)
    1.25 +		{
    1.26 +			XmlDocument document = WarFoundryXmlFactoryUtils.CreateXmlDocumentFromStream(new FileInfo(path).OpenRead());
    1.27 +			Assert.IsNotNull(document);
    1.28  		}
    1.29  	}
    1.30  }
     2.1 --- a/IBBoard.WarFoundry.API.Tests.csproj	Sat Mar 13 16:47:03 2010 +0000
     2.2 +++ b/IBBoard.WarFoundry.API.Tests.csproj	Sat Mar 13 20:50:31 2010 +0000
     2.3 @@ -81,6 +81,12 @@
     2.4      <None Include="testdata\extended-data.racex">
     2.5        <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     2.6      </None>
     2.7 +    <None Include="testdata\extended-data.systemx">
     2.8 +      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     2.9 +    </None>
    2.10 +    <None Include="testdata\extended-data.armyx">
    2.11 +      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    2.12 +    </None>
    2.13    </ItemGroup>
    2.14    <ItemGroup>
    2.15      <Reference Include="ICSharpCode.SharpZipLib, Version=0.85.5.452, Culture=neutral, PublicKeyToken=1b03e6acf1164f73">
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/testdata/extended-data.armyx	Sat Mar 13 20:50:31 2010 +0000
     3.3 @@ -0,0 +1,29 @@
     3.4 +<?xml version="1.0" encoding="UTF-8"?>
     3.5 +<army xmlns="http://ibboard.co.uk/warfoundry/army" xmlns:core="http://ibboard.co.uk/warfoundry/core" xmlns:ext="http://ibboard.co.uk/warfoundry/missing" id="army" name="" system="" race="" maxPoints="100" extraAttrib="value" ext:extraAttrib="en">
     3.6 +	<units extraAttrib="value" ext:extraAttrib="en">
     3.7 +		<unit id="unit1" unitType="swordsmen" unitName="Swordsment" size="10" extraAttrib="value" ext:extraAttrib="en">
     3.8 +			<equipment extraAttrib="value" ext:extraAttrib="en">
     3.9 +				<equipItem id="sword" amount="1" extraAttrib="value" ext:extraAttrib="en">
    3.10 +					<child></child>
    3.11 +					<child></child>
    3.12 +				</equipItem>
    3.13 +			</equipment>
    3.14 +			<contains>
    3.15 +				<containedUnit containedID="unit1" extraAttrib="value" ext:extraAttrib="en">
    3.16 +					<child></child>
    3.17 +					<child></child>
    3.18 +				</containedUnit>
    3.19 +			</contains>
    3.20 +			<child></child>
    3.21 +			<child></child>
    3.22 +		</unit>
    3.23 +	</units>
    3.24 +	<customEquipment extraAttrib="value" ext:extraAttrib="en">
    3.25 +		<customEquip id="custEquip" extraAttrib="value" ext:extraAttrib="en">
    3.26 +			<customEquipPart partIDRef="" extraAttrib="value" ext:extraAttrib="en">
    3.27 +				<child></child>
    3.28 +				<child></child>
    3.29 +			</customEquipPart>
    3.30 +		</customEquip>
    3.31 +	</customEquipment>
    3.32 +</army>
    3.33 \ No newline at end of file
     4.1 --- a/testdata/extended-data.racex	Sat Mar 13 16:47:03 2010 +0000
     4.2 +++ b/testdata/extended-data.racex	Sat Mar 13 20:50:31 2010 +0000
     4.3 @@ -3,6 +3,7 @@
     4.4  	<categories extraAttrib="value" ext:extraAttrib="en">
     4.5  		<cats:cat id="cat1" name="Cat1"  extraAttrib="value" ext:extraAttrib="en">
     4.6  			<child></child>
     4.7 +			<child></child>
     4.8  		</cats:cat>
     4.9  	</categories>
    4.10  	<units>
    4.11 @@ -15,17 +16,23 @@
    4.12  					<maxLimit>
    4.13  						<core:unitSizeLimit extraAttrib="value" ext:extraAttrib="en">
    4.14  							<child></child>
    4.15 +							<child></child>
    4.16  						</core:unitSizeLimit>
    4.17  					</maxLimit>
    4.18  					<child></child>
    4.19 +					<child></child>
    4.20  				</equipmentSlot>
    4.21  			</equipmentSlots>
    4.22  			<unitEquipment extraAttrib="value" ext:extraAttrib="en">
    4.23 -				<unitEquipmentItem id="equip1" required="true" extraAttrib="value" ext:extraAttrib="en"><child></child></unitEquipmentItem>
    4.24 +				<unitEquipmentItem id="equip1" required="true" extraAttrib="value" ext:extraAttrib="en">
    4.25 +					<child></child>
    4.26 +					<child></child>
    4.27 +				</unitEquipmentItem>
    4.28  			</unitEquipment>
    4.29  			<unitAbilities>
    4.30  				<unitAbility abilityID="a" extraAttrib="value" ext:extraAttrib="en">
    4.31  					<child></child>
    4.32 +					<child></child>
    4.33  				</unitAbility>
    4.34  			</unitAbilities>
    4.35  			<requirements>
    4.36 @@ -37,6 +44,7 @@
    4.37  			<contains>
    4.38  				<containedUnit containedID="Empire3" extraAttrib="value" ext:extraAttrib="en">
    4.39  					<child></child>
    4.40 +					<child></child>
    4.41  				</containedUnit>
    4.42  			</contains>
    4.43  		</unit>
    4.44 @@ -49,13 +57,16 @@
    4.45  	<equipment extraAttrib="value" ext:extraAttrib="en">
    4.46  		<equipmentItem id="equip1" name="sword" cost="1" extraAttrib="value" ext:extraAttrib="en">
    4.47  			<child></child>
    4.48 +			<child></child>
    4.49  		</equipmentItem>
    4.50  	</equipment>
    4.51  	<abilities extraAttrib="value" ext:extraAttrib="en">
    4.52  		<ability id="a" name="Ability 1" extraAttrib="value" ext:extraAttrib="en">
    4.53  			<description></description>
    4.54  			<child></child>
    4.55 +			<child></child>
    4.56  		</ability>
    4.57  	</abilities>
    4.58  	<child></child>
    4.59 +	<child></child>
    4.60  </race>
    4.61 \ No newline at end of file
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/testdata/extended-data.systemx	Sat Mar 13 20:50:31 2010 +0000
     5.3 @@ -0,0 +1,17 @@
     5.4 +<?xml version="1.0" encoding="UTF-8"?>
     5.5 +<system xmlns="http://ibboard.co.uk/warfoundry/system" xmlns:cats="http://ibboard.co.uk/warfoundry/cats" xmlns:ext="http://ibboard.co.uk/warfoundry/missing" id="test" name="Test Game System" warn="false" extraAttrib="value" ext:extraAttrib="en">
     5.6 +	<categories extraAttrib="value" ext:extraAttrib="en">
     5.7 +		<cats:cat id="cat1" name="Characters" minPercentage="0" maxPercentage="50" extraAttrib="value" ext:extraAttrib="en">
     5.8 +			<child></child>
     5.9 +			<child></child>
    5.10 +		</cats:cat>
    5.11 +	</categories>
    5.12 +	<sysStatsList defaultStats="whDefault" extraAttrib="value" ext:extraAttrib="en">
    5.13 +		<sysStats id="whDefault" extraAttrib="value" ext:extraAttrib="en">
    5.14 +			<sysStat name="M" extraAttrib="value" ext:extraAttrib="en">
    5.15 +				<child></child>
    5.16 +				<child></child>
    5.17 +			</sysStat>
    5.18 +		</sysStats>
    5.19 +	</sysStatsList>
    5.20 +</system>