changeset 85:052148dc0a2f

Re #99: Define "points" values in GameSystem * Test point string loading (checks shift of default value responsibility from GameSystem to factory) no-open-ticket
author IBBoard <dev@ibboard.co.uk>
date Sun, 20 Feb 2011 20:43:50 +0000
parents 168c5aab34bb
children d1ec7618f812
files API/Factories/Xml/WarFoundryXmlSystemFactoryTest.cs IBBoard.WarFoundry.API.Tests.csproj testdata/points-strings/names.systemx
diffstat 3 files changed, 50 insertions(+), 2 deletions(-) [+]
line diff
     1.1 --- a/API/Factories/Xml/WarFoundryXmlSystemFactoryTest.cs	Sun Feb 20 15:59:33 2011 +0000
     1.2 +++ b/API/Factories/Xml/WarFoundryXmlSystemFactoryTest.cs	Sun Feb 20 20:43:50 2011 +0000
     1.3 @@ -67,13 +67,33 @@
     1.4  		{
     1.5  			GameSystem system = SingleXmlObjectLoader.LoadGameSystemFromXML(WarFoundryXmlFactory.GetFactory(), new FileInfo("testdata/xml-system-factory/valid-categories.systemx"));
     1.6  			Assert.That(system.Categories, Has.Length(5));
     1.7 -		}	
     1.8 +		}
     1.9  
    1.10  		[Test()]
    1.11  		public void TestDuplicateCategoryIDErrors()
    1.12  		{
    1.13  			TestFileValidationFailure("testdata/xml-system-factory/duplicate-category-ids.systemx");
    1.14  		}
    1.15 +		
    1.16 +		[Test()]
    1.17 +		public void TestLoadingPointsNamesAndAbbreviations()
    1.18 +		{
    1.19 +			GameSystem system = SingleXmlObjectLoader.LoadGameSystemFromXML(WarFoundryXmlFactory.GetFactory(), new FileInfo("testdata/points-strings/names.systemx"));
    1.20 +			Assert.That(system.SystemPtsAbbrevPlural, Is.EqualTo("ptii"));
    1.21 +			Assert.That(system.SystemPtsAbbrevSingle, Is.EqualTo("ptus"));
    1.22 +			Assert.That(system.SystemPtsNamePlural, Is.EqualTo("pointii"));
    1.23 +			Assert.That(system.SystemPtsNameSingle, Is.EqualTo("pointus"));
    1.24 +		}
    1.25 +		
    1.26 +		[Test()]
    1.27 +		public void TestLoadingDefaultPointsNamesAndAbbreviations()
    1.28 +		{
    1.29 +			GameSystem system = SingleXmlObjectLoader.LoadGameSystemFromXML(WarFoundryXmlFactory.GetFactory(), new FileInfo("testdata/default.systemx"));
    1.30 +			Assert.That(system.SystemPtsAbbrevPlural, Is.EqualTo("pts"));
    1.31 +			Assert.That(system.SystemPtsAbbrevSingle, Is.EqualTo("pt"));
    1.32 +			Assert.That(system.SystemPtsNamePlural, Is.EqualTo("points"));
    1.33 +			Assert.That(system.SystemPtsNameSingle, Is.EqualTo("point"));
    1.34 +		}
    1.35  
    1.36  		private void TestFileValidationFailure(string filePath)
    1.37  		{
     2.1 --- a/IBBoard.WarFoundry.API.Tests.csproj	Sun Feb 20 15:59:33 2011 +0000
     2.2 +++ b/IBBoard.WarFoundry.API.Tests.csproj	Sun Feb 20 20:43:50 2011 +0000
     2.3 @@ -18,6 +18,7 @@
     2.4      <TargetFrameworkSubset>
     2.5      </TargetFrameworkSubset>
     2.6      <TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
     2.7 +    <IsWebBootstrapper>false</IsWebBootstrapper>
     2.8      <PublishUrl>publish\</PublishUrl>
     2.9      <Install>true</Install>
    2.10      <InstallFrom>Disk</InstallFrom>
    2.11 @@ -30,7 +31,6 @@
    2.12      <MapFileExtensions>true</MapFileExtensions>
    2.13      <ApplicationRevision>0</ApplicationRevision>
    2.14      <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
    2.15 -    <IsWebBootstrapper>false</IsWebBootstrapper>
    2.16      <UseApplicationTrust>false</UseApplicationTrust>
    2.17      <BootstrapperEnabled>true</BootstrapperEnabled>
    2.18    </PropertyGroup>
    2.19 @@ -260,6 +260,10 @@
    2.20      <None Include="testdata\subdir-loading-test\subdir\subdirfile.txt">
    2.21        <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    2.22      </None>
    2.23 +    <None Include="testdata\points-strings\names.systemx">
    2.24 +      <Gettext-ScanForTranslations>false</Gettext-ScanForTranslations>
    2.25 +      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    2.26 +    </None>
    2.27    </ItemGroup>
    2.28    <ItemGroup>
    2.29      <Reference Include="nunit.framework, Version=2.4.8.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77" />
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/testdata/points-strings/names.systemx	Sun Feb 20 20:43:50 2011 +0000
     3.3 @@ -0,0 +1,24 @@
     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 +		defaultPtsAbbreviationSingular="ptus" defaultPtsAbbreviationPlural="ptii" defaultPtsNameSingular="pointus" defaultPtsNamePlural="pointii">
     3.7 +	<categories>
     3.8 +		<cats:cat id="cat1" name="Characters" minPercentage="0" maxPercentage="50" />
     3.9 +		<cats:cat id="cat2" name="Regiments" minPercentage="25" maxPercentage="100" />
    3.10 +		<cats:cat id="cat3" name="War Machines" minPercentage="0" maxPercentage="25" />
    3.11 +		<cats:cat id="cat4" name="Monsters" minPercentage="0" maxPercentage="25" />
    3.12 +		<cats:cat id="cat5" name="Allies" minPercentage="0" maxPercentage="25" />
    3.13 +	</categories>
    3.14 +	<sysStatsList defaultStats="defaultStats">
    3.15 +		<sysStats id="defaultStats">
    3.16 +			<sysStat name="M"/>
    3.17 +			<sysStat name="WS"/>
    3.18 +			<sysStat name="BS"/>
    3.19 +			<sysStat name="S"/>
    3.20 +			<sysStat name="T"/>
    3.21 +			<sysStat name="W"/>
    3.22 +			<sysStat name="I"/>
    3.23 +			<sysStat name="A"/>
    3.24 +			<sysStat name="Ld"/>
    3.25 +		</sysStats>
    3.26 +	</sysStatsList>
    3.27 +</system>
    3.28 \ No newline at end of file