comparison API/Factories/Xml/WarFoundryXmlFactoryTests.cs @ 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
children 90dee8d781ee
comparison
equal deleted inserted replaced
86:d1ec7618f812 87:5c04db41d643
1 using System;
2 using NUnit.Framework;
3 using System.IO;
4 using System.Collections.Generic;
5 using IBBoard.WarFoundry.API.Objects;
6 using NUnit.Framework.SyntaxHelpers;
7
8 namespace IBBoard.WarFoundry.API.Factories.Xml
9 {
10 [TestFixture()]
11 public class WarFoundryXmlFactoryTests
12 {
13 [Test()]
14 public void TestFactoryHandlesMultipleFilesWithOldNamesInOneSystemZip()
15 {
16 ICollection<IWarFoundryObject> objs = WarFoundryXmlFactory.GetFactory().CreateObjectsFromFile(new FileInfo("testdata/multifile-zips/Test.system"));
17 Assert.That(objs, Has.Count(2));
18 int raceCount = 0;
19 int systemCount = 0;
20
21 foreach (IWarFoundryObject obj in objs)
22 {
23 if (obj is Race)
24 {
25 raceCount++;
26 }
27 else if (obj is GameSystem)
28 {
29 systemCount++;
30 }
31 }
32
33 Assert.That(raceCount, Is.EqualTo(1));
34 Assert.That(systemCount, Is.EqualTo(1));
35 }
36 }
37 }