changeset 71:a2095a3685fc

Re #297: Move Categories over to key/keyref from ID/IDREF * Initial tests for system category handling
author IBBoard <dev@ibboard.co.uk>
date Wed, 07 Jul 2010 19:01:32 +0000
parents 90a9f13b9627
children d1d79adcb11d
files API/Factories/Xml/WarFoundryXmlSystemFactoryTest.cs IBBoard.WarFoundry.API.Tests.csproj testdata/xml-system-factory/duplicate-category-ids.systemx testdata/xml-system-factory/valid-categories.systemx
diffstat 4 files changed, 61 insertions(+), 0 deletions(-) [+]
line diff
     1.1 --- a/API/Factories/Xml/WarFoundryXmlSystemFactoryTest.cs	Mon Jul 05 19:49:24 2010 +0000
     1.2 +++ b/API/Factories/Xml/WarFoundryXmlSystemFactoryTest.cs	Wed Jul 07 19:01:32 2010 +0000
     1.3 @@ -53,6 +53,18 @@
     1.4  			TestFileValidationFailure("testdata/xml-system-factory/duplicate-stats-set-id.systemx");
     1.5  		}
     1.6  		
     1.7 +		[Test()]
     1.8 +		public void TestValidCategoriesLoadsCorrectly()
     1.9 +		{
    1.10 +			GameSystem system = SingleXmlObjectLoader.LoadGameSystemFromXML(WarFoundryXmlFactory.GetFactory(), new FileInfo("testdata/xml-system-factory/valid-categories.systemx"));
    1.11 +			Assert.That(system.Categories, Has.Length(5));
    1.12 +		}	
    1.13 +		
    1.14 +		[Test()]
    1.15 +		public void TestDuplicateCategoryIDErrors()
    1.16 +		{
    1.17 +			TestFileValidationFailure("testdata/xml-system-factory/duplicate-category-ids.systemx");
    1.18 +		}
    1.19  		
    1.20  		private void TestFileValidationFailure(string filePath)
    1.21  		{
     2.1 --- a/IBBoard.WarFoundry.API.Tests.csproj	Mon Jul 05 19:49:24 2010 +0000
     2.2 +++ b/IBBoard.WarFoundry.API.Tests.csproj	Wed Jul 07 19:01:32 2010 +0000
     2.3 @@ -213,6 +213,12 @@
     2.4      <None Include="testdata\xml-system-factory\duplicate-stats-set-id.systemx">
     2.5        <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     2.6      </None>
     2.7 +    <None Include="testdata\xml-system-factory\valid-categories.systemx">
     2.8 +      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     2.9 +    </None>
    2.10 +    <None Include="testdata\xml-system-factory\duplicate-category-ids.systemx">
    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/xml-system-factory/duplicate-category-ids.systemx	Wed Jul 07 19:01:32 2010 +0000
     3.3 @@ -0,0 +1,20 @@
     3.4 +<?xml version="1.0" encoding="UTF-8"?>
     3.5 +<system xmlns="http://ibboard.co.uk/warfoundry/system" xmlns:cats="http://ibboard.co.uk/warfoundry/cats" id="default" name="Default Game System" warn="false">
     3.6 +	<categories>
     3.7 +		<cats:cat id="cat1" name="Characters" minPercentage="0" maxPercentage="50" />
     3.8 +		<cats:cat id="cat1" name="Regiments" minPercentage="25" maxPercentage="100" />
     3.9 +	</categories>
    3.10 +	<sysStatsList defaultStats="defaultStats">
    3.11 +		<sysStats id="defaultStats">
    3.12 +			<sysStat name="M"/>
    3.13 +			<sysStat name="WS"/>
    3.14 +			<sysStat name="BS"/>
    3.15 +			<sysStat name="S"/>
    3.16 +			<sysStat name="T"/>
    3.17 +			<sysStat name="W"/>
    3.18 +			<sysStat name="I"/>
    3.19 +			<sysStat name="A"/>
    3.20 +			<sysStat name="Ld"/>
    3.21 +		</sysStats>
    3.22 +	</sysStatsList>
    3.23 +</system>
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/testdata/xml-system-factory/valid-categories.systemx	Wed Jul 07 19:01:32 2010 +0000
     4.3 @@ -0,0 +1,23 @@
     4.4 +<?xml version="1.0" encoding="UTF-8"?>
     4.5 +<system xmlns="http://ibboard.co.uk/warfoundry/system" xmlns:cats="http://ibboard.co.uk/warfoundry/cats" id="default" name="Default Game System" warn="false">
     4.6 +	<categories>
     4.7 +		<cats:cat id="cat1" name="Characters" minPercentage="0" maxPercentage="50" />
     4.8 +		<cats:cat id="cat2" name="Regiments" minPercentage="25" maxPercentage="100" />
     4.9 +		<cats:cat id="cat3" name="War Machines" minPercentage="0" maxPercentage="25" />
    4.10 +		<cats:cat id="cat4" name="Monsters" minPercentage="0" maxPercentage="25" />
    4.11 +		<cats:cat id="cat5" name="Allies" minPercentage="0" maxPercentage="25" />
    4.12 +	</categories>
    4.13 +	<sysStatsList defaultStats="defaultStats">
    4.14 +		<sysStats id="defaultStats">
    4.15 +			<sysStat name="M"/>
    4.16 +			<sysStat name="WS"/>
    4.17 +			<sysStat name="BS"/>
    4.18 +			<sysStat name="S"/>
    4.19 +			<sysStat name="T"/>
    4.20 +			<sysStat name="W"/>
    4.21 +			<sysStat name="I"/>
    4.22 +			<sysStat name="A"/>
    4.23 +			<sysStat name="Ld"/>
    4.24 +		</sysStats>
    4.25 +	</sysStatsList>
    4.26 +</system>