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 wrap: on
line diff
--- a/API/Factories/Xml/WarFoundryXmlFactoryUtilTest.cs	Sat Mar 13 16:47:03 2010 +0000
+++ b/API/Factories/Xml/WarFoundryXmlFactoryUtilTest.cs	Sat Mar 13 20:50:31 2010 +0000
@@ -4,6 +4,7 @@
 
 using System;
 using System.IO;
+using System.Xml;
 using NUnit.Framework;
 
 namespace IBBoard.WarFoundry.API.Factories.Xml
@@ -12,9 +13,17 @@
 	public class WarFoundryXmlFactoryUtilTest
 	{
 		[Test()]
-		public void TestParsingExtendedDataFile()
+		public void TestParsingExtendedDataFiles()
 		{
-			WarFoundryXmlFactoryUtils.CreateXmlDocumentFromStream(new FileInfo("testdata/extended-data.racex").OpenRead());		
+			TestParsingExtendedDataFile("testdata/extended-data.racex");
+			TestParsingExtendedDataFile("testdata/extended-data.systemx");
+			TestParsingExtendedDataFile("testdata/extended-data.armyx");
+		}
+		
+		private static void TestParsingExtendedDataFile(string path)
+		{
+			XmlDocument document = WarFoundryXmlFactoryUtils.CreateXmlDocumentFromStream(new FileInfo(path).OpenRead());
+			Assert.IsNotNull(document);
 		}
 	}
 }
--- a/IBBoard.WarFoundry.API.Tests.csproj	Sat Mar 13 16:47:03 2010 +0000
+++ b/IBBoard.WarFoundry.API.Tests.csproj	Sat Mar 13 20:50:31 2010 +0000
@@ -81,6 +81,12 @@
     <None Include="testdata\extended-data.racex">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </None>
+    <None Include="testdata\extended-data.systemx">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </None>
+    <None Include="testdata\extended-data.armyx">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </None>
   </ItemGroup>
   <ItemGroup>
     <Reference Include="ICSharpCode.SharpZipLib, Version=0.85.5.452, Culture=neutral, PublicKeyToken=1b03e6acf1164f73">
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testdata/extended-data.armyx	Sat Mar 13 20:50:31 2010 +0000
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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">
+	<units extraAttrib="value" ext:extraAttrib="en">
+		<unit id="unit1" unitType="swordsmen" unitName="Swordsment" size="10" extraAttrib="value" ext:extraAttrib="en">
+			<equipment extraAttrib="value" ext:extraAttrib="en">
+				<equipItem id="sword" amount="1" extraAttrib="value" ext:extraAttrib="en">
+					<child></child>
+					<child></child>
+				</equipItem>
+			</equipment>
+			<contains>
+				<containedUnit containedID="unit1" extraAttrib="value" ext:extraAttrib="en">
+					<child></child>
+					<child></child>
+				</containedUnit>
+			</contains>
+			<child></child>
+			<child></child>
+		</unit>
+	</units>
+	<customEquipment extraAttrib="value" ext:extraAttrib="en">
+		<customEquip id="custEquip" extraAttrib="value" ext:extraAttrib="en">
+			<customEquipPart partIDRef="" extraAttrib="value" ext:extraAttrib="en">
+				<child></child>
+				<child></child>
+			</customEquipPart>
+		</customEquip>
+	</customEquipment>
+</army>
\ No newline at end of file
--- a/testdata/extended-data.racex	Sat Mar 13 16:47:03 2010 +0000
+++ b/testdata/extended-data.racex	Sat Mar 13 20:50:31 2010 +0000
@@ -3,6 +3,7 @@
 	<categories extraAttrib="value" ext:extraAttrib="en">
 		<cats:cat id="cat1" name="Cat1"  extraAttrib="value" ext:extraAttrib="en">
 			<child></child>
+			<child></child>
 		</cats:cat>
 	</categories>
 	<units>
@@ -15,17 +16,23 @@
 					<maxLimit>
 						<core:unitSizeLimit extraAttrib="value" ext:extraAttrib="en">
 							<child></child>
+							<child></child>
 						</core:unitSizeLimit>
 					</maxLimit>
 					<child></child>
+					<child></child>
 				</equipmentSlot>
 			</equipmentSlots>
 			<unitEquipment extraAttrib="value" ext:extraAttrib="en">
-				<unitEquipmentItem id="equip1" required="true" extraAttrib="value" ext:extraAttrib="en"><child></child></unitEquipmentItem>
+				<unitEquipmentItem id="equip1" required="true" extraAttrib="value" ext:extraAttrib="en">
+					<child></child>
+					<child></child>
+				</unitEquipmentItem>
 			</unitEquipment>
 			<unitAbilities>
 				<unitAbility abilityID="a" extraAttrib="value" ext:extraAttrib="en">
 					<child></child>
+					<child></child>
 				</unitAbility>
 			</unitAbilities>
 			<requirements>
@@ -37,6 +44,7 @@
 			<contains>
 				<containedUnit containedID="Empire3" extraAttrib="value" ext:extraAttrib="en">
 					<child></child>
+					<child></child>
 				</containedUnit>
 			</contains>
 		</unit>
@@ -49,13 +57,16 @@
 	<equipment extraAttrib="value" ext:extraAttrib="en">
 		<equipmentItem id="equip1" name="sword" cost="1" extraAttrib="value" ext:extraAttrib="en">
 			<child></child>
+			<child></child>
 		</equipmentItem>
 	</equipment>
 	<abilities extraAttrib="value" ext:extraAttrib="en">
 		<ability id="a" name="Ability 1" extraAttrib="value" ext:extraAttrib="en">
 			<description></description>
 			<child></child>
+			<child></child>
 		</ability>
 	</abilities>
 	<child></child>
+	<child></child>
 </race>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testdata/extended-data.systemx	Sat Mar 13 20:50:31 2010 +0000
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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">
+	<categories extraAttrib="value" ext:extraAttrib="en">
+		<cats:cat id="cat1" name="Characters" minPercentage="0" maxPercentage="50" extraAttrib="value" ext:extraAttrib="en">
+			<child></child>
+			<child></child>
+		</cats:cat>
+	</categories>
+	<sysStatsList defaultStats="whDefault" extraAttrib="value" ext:extraAttrib="en">
+		<sysStats id="whDefault" extraAttrib="value" ext:extraAttrib="en">
+			<sysStat name="M" extraAttrib="value" ext:extraAttrib="en">
+				<child></child>
+				<child></child>
+			</sysStat>
+		</sysStats>
+	</sysStatsList>
+</system>