diff API/Factories/Xml/WarFoundryXmlFactoryTests.cs @ 228:7c21ca1482cb

Re #419: Remove assumptions of a file-based install * Update tests to use new "loadable object" and "loadable object source" wrappers
author IBBoard <dev@ibboard.co.uk>
date Sat, 07 Jul 2012 21:02:53 +0100
parents 3c2c108a2f08
children 6ec46f3db2d4
line wrap: on
line diff
--- a/API/Factories/Xml/WarFoundryXmlFactoryTests.cs	Mon Apr 16 20:45:45 2012 +0100
+++ b/API/Factories/Xml/WarFoundryXmlFactoryTests.cs	Sat Jul 07 21:02:53 2012 +0100
@@ -4,6 +4,7 @@
 using System.Collections.Generic;
 using IBBoard.WarFoundry.API.Objects;
 using NUnit.Framework.SyntaxHelpers;
+using IBBoard.WarFoundry.API.Loading;
 
 namespace IBBoard.WarFoundry.API.Factories.Xml
 {
@@ -19,7 +20,7 @@
 			try
 			{
 				loader.RegisterFactory(factory);
-				ICollection<IWarFoundryObject> objs = factory.CreateObjectsFromFile(new FileInfo("testdata/multifile-zips/Test.system"));
+				ICollection<IWarFoundryObject> objs = factory.CreateObjectsFromFile(new LoadableFileObject("testdata/multifile-zips/Test.system"));
 				Assert.That(objs, Has.Count(2));
 				int raceCount = 0;
 				int systemCount = 0;
@@ -30,7 +31,8 @@
 					{
 						raceCount++;
 					}
-					else if (obj is GameSystem)
+					else
+					if (obj is GameSystem)
 					{
 						systemCount++;
 					}
@@ -54,7 +56,7 @@
 			loader.RegisterFactory(factory);
 			try
 			{
-				ICollection<IWarFoundryObject> objs = factory.CreateObjectsFromFile(new FileInfo("testdata/multifile-zips/Test.race"));
+				ICollection<IWarFoundryObject> objs = factory.CreateObjectsFromFile(new LoadableFileObject("testdata/multifile-zips/Test.race"));
 				Assert.That(objs, Has.Count(2));
 				int raceCount = 0;
 				int systemCount = 0;
@@ -65,7 +67,8 @@
 					{
 						raceCount++;
 					}
-					else if (obj is GameSystem)
+					else
+					if (obj is GameSystem)
 					{
 						systemCount++;
 					}
@@ -89,7 +92,7 @@
 			loader.RegisterFactory(factory);
 			try
 			{
-				ICollection<IWarFoundryObject> objs = factory.CreateObjectsFromFile(new FileInfo("testdata/multifile-zips/Multipack.system"));
+				ICollection<IWarFoundryObject> objs = factory.CreateObjectsFromFile(new LoadableFileObject("testdata/multifile-zips/Multipack.system"));
 				Assert.That(objs, Has.Count(4));
 				int raceCount = 0;
 				int systemCount = 0;
@@ -100,7 +103,8 @@
 					{
 						raceCount++;
 					}
-					else if (obj is GameSystem)
+					else
+					if (obj is GameSystem)
 					{
 						systemCount++;
 					}