Mercurial > repos > IBDev-IBBoard.WarFoundry.API.Tests
changeset 38:feb77f3287ca
Re #152: Test and fix extensibility of current schemas
* Add unit test for parsing extended document without XSD for namespace
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sat, 27 Feb 2010 15:03:51 +0000 |
parents | bf46c113d85c |
children | 5669f2ef6444 |
files | API/Factories/Xml/WarFoundryXmlFactoryUtilTest.cs IBBoard.WarFoundry.API.Tests.csproj testdata/extended-data.racex |
diffstat | 3 files changed, 112 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/API/Factories/Xml/WarFoundryXmlFactoryUtilTest.cs Sat Feb 27 15:03:51 2010 +0000 @@ -0,0 +1,20 @@ +// This file (WarFoundryXmlFactoryUtilTest.cs) is a part of the IBBoard.WarFoundry.API.Tests project and is copyright 2010 IBBoard +// +// // The file and the library/program it is in are licensed and distributed, without warranty, under the GNU Affero GPL license, either version 3 of the License or (at your option) any later version. Please see COPYING for more information and the full license. + +using System; +using System.IO; +using NUnit.Framework; + +namespace IBBoard.WarFoundry.API.Factories.Xml +{ + [TestFixture()] + public class WarFoundryXmlFactoryUtilTest + { + [Test()] + public void TestParsingExtendedDataFile() + { + WarFoundryXmlFactoryUtils.CreateXmlDocumentFromStream(new FileInfo("testdata/extended-data.racex").OpenRead()); + } + } +}
--- a/IBBoard.WarFoundry.API.Tests.csproj Sat Feb 27 14:26:19 2010 +0000 +++ b/IBBoard.WarFoundry.API.Tests.csproj Sat Feb 27 15:03:51 2010 +0000 @@ -59,6 +59,7 @@ <Compile Include="API\Factories\Xml\WarFoundryXmlRaceFactoryTest.cs" /> <Compile Include="API\FixedGameSystemWarFoundryLoader.cs" /> <Compile Include="API\Factories\Xml\SingleXmlObjectLoader.cs" /> + <Compile Include="API\Factories\Xml\WarFoundryXmlFactoryUtilTest.cs" /> </ItemGroup> <ItemGroup> <None Include="testdata\Test.race"> @@ -77,6 +78,9 @@ <None Include="testdata\race-with-non-existant-ability.systemx"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </None> + <None Include="testdata\extended-data.racex"> + <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.racex Sat Feb 27 15:03:51 2010 +0000 @@ -0,0 +1,88 @@ +<?xml version="1.0" encoding="UTF-8"?> +<race xmlns="http://ibboard.co.uk/warfoundry/race" xmlns:ext="http://ibboard.co.uk/warfoundry/attrib" id="EmpireAlt" name="Empire (Extended)" system="test" ext:extraAttrib="en"> + <units> + <unit id="Empire1" typeName="Empire General" cat="cat1" points="100" maxNum="1" maxSize="1"> + <stats> + <stat name="m">4</stat> + <stat name="WS">6</stat> + <stat name="BS">6</stat> + <stat name="S">4</stat> + <stat name="T">4</stat> + <stat name="W">3</stat> + <stat name="I">6</stat> + <stat name="A">4</stat> + <stat name="Ld">9</stat> + </stats> + <unitEquipment> + <unitEquipmentItem id="equip1" required="true" /> + </unitEquipment> + </unit> + <unit id="Empire2" typeName="Swordsmen" cat="cat2" points="10"> + <stats> + <stat name="M">4</stat> + <stat name="WS">3</stat> + <stat name="BS">3</stat> + <stat name="S">4</stat> + <stat name="T">3</stat> + <stat name="W">1</stat> + <stat name="I">4</stat> + <stat name="A">1</stat> + <stat name="Ld">7</stat> + </stats> + <unitEquipment> + <unitEquipmentItem id="equip1" required="true" exclusivityGroup="group1" /> + <unitEquipmentItem id="equip2"/> + <unitEquipmentItem id="equip3" required="true" exclusivityGroup="group1" /> + </unitEquipment> + <contains> + <containedUnit containedID="Empire3" /> + </contains> + </unit> + <unit id="Empire3" typeName="Swordsmen Champion" cat="cat2" points="35"> + <stats> + <stat name="M">4</stat> + <stat name="WS">4</stat> + <stat name="BS">3</stat> + <stat name="S">4</stat> + <stat name="T">3</stat> + <stat name="W">1</stat> + <stat name="I">4</stat> + <stat name="A">2</stat> + <stat name="Ld">7</stat> + </stats> + <unitEquipment> + <unitEquipmentItem id="equip1" required="true" exclusivityGroup="group1" /> + <unitEquipmentItem id="equip2"/> + <unitEquipmentItem id="equip3" required="true" exclusivityGroup="group1" /> + </unitEquipment> + </unit> + <unit id="Empire4" typeName="Gunnery Specialists" cat="cat2" points="15"> + <stats> + <stat name="M">4</stat> + <stat name="WS">3</stat> + <stat name="BS">4</stat> + <stat name="S">4</stat> + <stat name="T">3</stat> + <stat name="W">1</stat> + <stat name="I">4</stat> + <stat name="A">1</stat> + <stat name="Ld">7</stat> + </stats> + <unitEquipment> + <unitEquipmentItem id="equip4" required="true" exclusivityGroup="group1" minPercentage="50" maxPercentage="100" /> + <unitEquipmentItem id="equip1" required="true" /> + <unitEquipmentItem id="equip5" minNum="0" maxNum="5" /> + </unitEquipment> + <contains> + <containedUnit containedID="Empire3" /> + </contains> + </unit> + </units> + <equipment> + <equipmentItem id="equip1" name="sword" cost="1"/> + <equipmentItem id="equip2" name="shield" cost="1"/> + <equipmentItem id="equip3" name="broadsword" cost="2" /> + <equipmentItem id="equip4" name="Standard Guns" cost="3" /> + <equipmentItem id="equip5" name="Special Guns" cost="5" /> + </equipment> +</race>