Mercurial > repos > IBDev-IBBoard.WarFoundry.API.Tests
changeset 87:5c04db41d643
Re #253: Allow multiple data files in a single zip
* Add test data and initial test
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sat, 26 Feb 2011 20:14:29 +0000 |
parents | d1ec7618f812 |
children | 31fd34f7d7cf |
files | API/Factories/Xml/WarFoundryXmlFactoryTests.cs IBBoard.WarFoundry.API.Tests.csproj testdata/multifile-zips/Multipack.system testdata/multifile-zips/Test.race testdata/multifile-zips/Test.system |
diffstat | 5 files changed, 52 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/API/Factories/Xml/WarFoundryXmlFactoryTests.cs Sat Feb 26 20:14:29 2011 +0000 @@ -0,0 +1,37 @@ +using System; +using NUnit.Framework; +using System.IO; +using System.Collections.Generic; +using IBBoard.WarFoundry.API.Objects; +using NUnit.Framework.SyntaxHelpers; + +namespace IBBoard.WarFoundry.API.Factories.Xml +{ + [TestFixture()] + public class WarFoundryXmlFactoryTests + { + [Test()] + public void TestFactoryHandlesMultipleFilesWithOldNamesInOneSystemZip() + { + ICollection<IWarFoundryObject> objs = WarFoundryXmlFactory.GetFactory().CreateObjectsFromFile(new FileInfo("testdata/multifile-zips/Test.system")); + Assert.That(objs, Has.Count(2)); + int raceCount = 0; + int systemCount = 0; + + foreach (IWarFoundryObject obj in objs) + { + if (obj is Race) + { + raceCount++; + } + else if (obj is GameSystem) + { + systemCount++; + } + } + + Assert.That(raceCount, Is.EqualTo(1)); + Assert.That(systemCount, Is.EqualTo(1)); + } + } +}
--- a/IBBoard.WarFoundry.API.Tests.csproj Wed Feb 23 20:37:59 2011 +0000 +++ b/IBBoard.WarFoundry.API.Tests.csproj Sat Feb 26 20:14:29 2011 +0000 @@ -1,5 +1,5 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5"> +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> @@ -88,6 +88,7 @@ <Compile Include="MockObjects\MockWarFoundryLoader.cs" /> <Compile Include="API\AbstractWarFoundryLoaderTests.cs" /> <Compile Include="API\Objects\GameSystemTest.cs" /> + <Compile Include="API\Factories\Xml\WarFoundryXmlFactoryTests.cs" /> </ItemGroup> <ItemGroup> <None Include="app.config" /> @@ -264,6 +265,15 @@ <Gettext-ScanForTranslations>false</Gettext-ScanForTranslations> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </None> + <None Include="testdata\multifile-zips\Multipack.system"> + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> + </None> + <None Include="testdata\multifile-zips\Test.race"> + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> + </None> + <None Include="testdata\multifile-zips\Test.system"> + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> + </None> </ItemGroup> <ItemGroup> <Reference Include="nunit.framework, Version=2.4.8.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77" /> @@ -325,4 +335,7 @@ <Install>true</Install> </BootstrapperPackage> </ItemGroup> + <ItemGroup> + <Folder Include="testdata\multifile-zips\" /> + </ItemGroup> </Project> \ No newline at end of file