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 wrap: on
line diff
--- a/API/Factories/Xml/WarFoundryXmlSystemFactoryTest.cs	Sun Feb 20 15:59:33 2011 +0000
+++ b/API/Factories/Xml/WarFoundryXmlSystemFactoryTest.cs	Sun Feb 20 20:43:50 2011 +0000
@@ -67,13 +67,33 @@
 		{
 			GameSystem system = SingleXmlObjectLoader.LoadGameSystemFromXML(WarFoundryXmlFactory.GetFactory(), new FileInfo("testdata/xml-system-factory/valid-categories.systemx"));
 			Assert.That(system.Categories, Has.Length(5));
-		}	
+		}
 
 		[Test()]
 		public void TestDuplicateCategoryIDErrors()
 		{
 			TestFileValidationFailure("testdata/xml-system-factory/duplicate-category-ids.systemx");
 		}
+		
+		[Test()]
+		public void TestLoadingPointsNamesAndAbbreviations()
+		{
+			GameSystem system = SingleXmlObjectLoader.LoadGameSystemFromXML(WarFoundryXmlFactory.GetFactory(), new FileInfo("testdata/points-strings/names.systemx"));
+			Assert.That(system.SystemPtsAbbrevPlural, Is.EqualTo("ptii"));
+			Assert.That(system.SystemPtsAbbrevSingle, Is.EqualTo("ptus"));
+			Assert.That(system.SystemPtsNamePlural, Is.EqualTo("pointii"));
+			Assert.That(system.SystemPtsNameSingle, Is.EqualTo("pointus"));
+		}
+		
+		[Test()]
+		public void TestLoadingDefaultPointsNamesAndAbbreviations()
+		{
+			GameSystem system = SingleXmlObjectLoader.LoadGameSystemFromXML(WarFoundryXmlFactory.GetFactory(), new FileInfo("testdata/default.systemx"));
+			Assert.That(system.SystemPtsAbbrevPlural, Is.EqualTo("pts"));
+			Assert.That(system.SystemPtsAbbrevSingle, Is.EqualTo("pt"));
+			Assert.That(system.SystemPtsNamePlural, Is.EqualTo("points"));
+			Assert.That(system.SystemPtsNameSingle, Is.EqualTo("point"));
+		}
 
 		private void TestFileValidationFailure(string filePath)
 		{
--- a/IBBoard.WarFoundry.API.Tests.csproj	Sun Feb 20 15:59:33 2011 +0000
+++ b/IBBoard.WarFoundry.API.Tests.csproj	Sun Feb 20 20:43:50 2011 +0000
@@ -18,6 +18,7 @@
     <TargetFrameworkSubset>
     </TargetFrameworkSubset>
     <TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
+    <IsWebBootstrapper>false</IsWebBootstrapper>
     <PublishUrl>publish\</PublishUrl>
     <Install>true</Install>
     <InstallFrom>Disk</InstallFrom>
@@ -30,7 +31,6 @@
     <MapFileExtensions>true</MapFileExtensions>
     <ApplicationRevision>0</ApplicationRevision>
     <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
-    <IsWebBootstrapper>false</IsWebBootstrapper>
     <UseApplicationTrust>false</UseApplicationTrust>
     <BootstrapperEnabled>true</BootstrapperEnabled>
   </PropertyGroup>
@@ -260,6 +260,10 @@
     <None Include="testdata\subdir-loading-test\subdir\subdirfile.txt">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </None>
+    <None Include="testdata\points-strings\names.systemx">
+      <Gettext-ScanForTranslations>false</Gettext-ScanForTranslations>
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </None>
   </ItemGroup>
   <ItemGroup>
     <Reference Include="nunit.framework, Version=2.4.8.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77" />
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testdata/points-strings/names.systemx	Sun Feb 20 20:43:50 2011 +0000
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<system xmlns="http://ibboard.co.uk/warfoundry/system" xmlns:cats="http://ibboard.co.uk/warfoundry/cats" id="default" name="Default Game System" warn="false"
+		defaultPtsAbbreviationSingular="ptus" defaultPtsAbbreviationPlural="ptii" defaultPtsNameSingular="pointus" defaultPtsNamePlural="pointii">
+	<categories>
+		<cats:cat id="cat1" name="Characters" minPercentage="0" maxPercentage="50" />
+		<cats:cat id="cat2" name="Regiments" minPercentage="25" maxPercentage="100" />
+		<cats:cat id="cat3" name="War Machines" minPercentage="0" maxPercentage="25" />
+		<cats:cat id="cat4" name="Monsters" minPercentage="0" maxPercentage="25" />
+		<cats:cat id="cat5" name="Allies" minPercentage="0" maxPercentage="25" />
+	</categories>
+	<sysStatsList defaultStats="defaultStats">
+		<sysStats id="defaultStats">
+			<sysStat name="M"/>
+			<sysStat name="WS"/>
+			<sysStat name="BS"/>
+			<sysStat name="S"/>
+			<sysStat name="T"/>
+			<sysStat name="W"/>
+			<sysStat name="I"/>
+			<sysStat name="A"/>
+			<sysStat name="Ld"/>
+		</sysStats>
+	</sysStatsList>
+</system>
\ No newline at end of file