Mercurial > repos > IBBoard.WarFoundry.API.Tests
changeset 75:72479ca6feb4
Fixes #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
* Add a unit test for the failure
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sat, 30 Oct 2010 14:45:45 +0000 |
parents | 5bf51f7a28ce |
children | fb60ff2002fd |
files | API/Factories/Xml/WarFoundryXmlSystemFactoryTest.cs IBBoard.WarFoundry.API.Tests.csproj |
diffstat | 2 files changed, 19 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/API/Factories/Xml/WarFoundryXmlSystemFactoryTest.cs Sat Oct 30 14:27:20 2010 +0000 +++ b/API/Factories/Xml/WarFoundryXmlSystemFactoryTest.cs Sat Oct 30 14:45:45 2010 +0000 @@ -1,6 +1,7 @@ // This file (WarFoundryXmlSystemFactoryTest.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 NUnit.Framework; using System.IO; @@ -15,6 +16,14 @@ public class WarFoundryXmlSystemFactoryTest { [Test()] + public void TestBug311InvalidVersionToExtract788() + { + FileInfo repackFile = new FileInfo("testdata/zip-format/Repack.system"); + Assert.That(WarFoundryXmlFactory.GetFactory().CanHandleFileAsGameSystem(repackFile), Is.True); + Assert.That(WarFoundryXmlFactory.GetFactory().CreateObjectsFromFile(repackFile), Has.Count(1)); + } + + [Test()] public void TestGettingDefaultStatsIDFullyLoadsGameSystem() { GameSystem system = SingleXmlObjectLoader.LoadGameSystemFromXML(WarFoundryXmlFactory.GetFactory(), new FileInfo("testdata/xml-system-factory/valid-default-stats-one-stats-set.systemx")); @@ -24,7 +33,7 @@ Assert.That(defaultStatsID, Is.Not.Empty); Assert.That(system.IsFullyLoaded, Is.True); } - + [Test()] public void TestValidDefaultStatsIDLoadsCorrectly() { @@ -32,7 +41,7 @@ Assert.That(system.StandardSystemStatsID, Is.EqualTo("defaultStats")); Assert.That(system.SystemStats, Has.Length(1)); } - + [Test()] public void TestValidDefaultStatsIDLoadsCorrectlyWithMultipleStatsSets() { @@ -40,32 +49,32 @@ Assert.That(system.StandardSystemStatsID, Is.EqualTo("defaultStats")); Assert.That(system.SystemStats, Has.Length(2)); } - + [Test()] public void TestIncorrectDefaultStatsIDErrors() { TestFileValidationFailure("testdata/xml-system-factory/invalid-default-stats.systemx"); } - + [Test()] public void TestDuplicateStatsIDErrors() { TestFileValidationFailure("testdata/xml-system-factory/duplicate-stats-set-id.systemx"); } - + [Test()] public void TestValidCategoriesLoadsCorrectly() { 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"); } - + private void TestFileValidationFailure(string filePath) { FileInfo systemFile = new FileInfo(filePath);
--- a/IBBoard.WarFoundry.API.Tests.csproj Sat Oct 30 14:27:20 2010 +0000 +++ b/IBBoard.WarFoundry.API.Tests.csproj Sat Oct 30 14:45:45 2010 +0000 @@ -231,6 +231,9 @@ <None Include="testdata\xml-race-factory\duplicate-category-ids.racex"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </None> + <None Include="testdata\zip-format\Repack.system"> + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> + </None> </ItemGroup> <ItemGroup> <Reference Include="nunit.framework, Version=2.4.8.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77" />