comparison API/Factories/AbstractNativeWarFoundryFactoryTest.cs @ 196:498396c77601

Re #380: WarFoundry chokes on zips written by Mac OS X * Add test to check that entries are found but skipped for loading * Add mock file that extends the standard XML factory to give us public access to protected methods
author IBBoard <dev@ibboard.co.uk>
date Sun, 04 Dec 2011 20:52:24 +0000
parents 6dce5122caca
children 7c21ca1482cb
comparison
equal deleted inserted replaced
195:8e95ccb8e9d5 196:498396c77601
5 using NUnit.Framework; 5 using NUnit.Framework;
6 using IBBoard.WarFoundry.API.Factories.Mock; 6 using IBBoard.WarFoundry.API.Factories.Mock;
7 using System.Diagnostics; 7 using System.Diagnostics;
8 using NUnit.Framework.SyntaxHelpers; 8 using NUnit.Framework.SyntaxHelpers;
9 using System.IO; 9 using System.IO;
10 using IBBoard.WarFoundry.API.Objects;
11 using System.Collections.Generic;
10 12
11 namespace IBBoard.WarFoundry.API.Factories 13 namespace IBBoard.WarFoundry.API.Factories
12 { 14 {
13 [TestFixture] 15 [TestFixture]
14 public class AbstractNativeWarFoundryFactoryTest 16 public class AbstractNativeWarFoundryFactoryTest
37 //This will also be triggered by Bug94TestLoadingTimesForNonZipFiles, but this makes it separate and explicit 39 //This will also be triggered by Bug94TestLoadingTimesForNonZipFiles, but this makes it separate and explicit
38 FileInfo nonRaceFile = new FileInfo("testdata/NotARaceFile.txt"); 40 FileInfo nonRaceFile = new FileInfo("testdata/NotARaceFile.txt");
39 Assert.That(nonRaceFile.Exists, Is.True); 41 Assert.That(nonRaceFile.Exists, Is.True);
40 Assert.That(factory.CanHandleFileFormat(nonRaceFile), Is.False); 42 Assert.That(factory.CanHandleFileFormat(nonRaceFile), Is.False);
41 } 43 }
44
45 [Test]
46 public void Bug380TestLoadingOfOSXesqueFile()
47 {
48 FileSearchingWarFoundryFactory factory = new FileSearchingWarFoundryFactory();
49 FileInfo file = new FileInfo("testdata/multifile-zips/Test-OSX-style.system");
50 Assert.That(factory.GetGameSystemZipEntries(file), Has.Count(3));
51 Assert.That(factory.GetRaceZipEntries(file), Has.Count(3));
52 Assert.That(factory.GetArmyZipEntries(file), Has.Count(3));
53 ICollection<IWarFoundryObject> objs = factory.CreateObjectsFromFile(file);
54 Assert.That(objs, Has.Count(0));
55 }
42 } 56 }
43 } 57 }
44 58