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 diff
     1.1 --- a/API/Factories/Xml/WarFoundryXmlFactoryTests.cs	Mon Apr 16 20:45:45 2012 +0100
     1.2 +++ b/API/Factories/Xml/WarFoundryXmlFactoryTests.cs	Sat Jul 07 21:02:53 2012 +0100
     1.3 @@ -4,6 +4,7 @@
     1.4  using System.Collections.Generic;
     1.5  using IBBoard.WarFoundry.API.Objects;
     1.6  using NUnit.Framework.SyntaxHelpers;
     1.7 +using IBBoard.WarFoundry.API.Loading;
     1.8  
     1.9  namespace IBBoard.WarFoundry.API.Factories.Xml
    1.10  {
    1.11 @@ -19,7 +20,7 @@
    1.12  			try
    1.13  			{
    1.14  				loader.RegisterFactory(factory);
    1.15 -				ICollection<IWarFoundryObject> objs = factory.CreateObjectsFromFile(new FileInfo("testdata/multifile-zips/Test.system"));
    1.16 +				ICollection<IWarFoundryObject> objs = factory.CreateObjectsFromFile(new LoadableFileObject("testdata/multifile-zips/Test.system"));
    1.17  				Assert.That(objs, Has.Count(2));
    1.18  				int raceCount = 0;
    1.19  				int systemCount = 0;
    1.20 @@ -30,7 +31,8 @@
    1.21  					{
    1.22  						raceCount++;
    1.23  					}
    1.24 -					else if (obj is GameSystem)
    1.25 +					else
    1.26 +					if (obj is GameSystem)
    1.27  					{
    1.28  						systemCount++;
    1.29  					}
    1.30 @@ -54,7 +56,7 @@
    1.31  			loader.RegisterFactory(factory);
    1.32  			try
    1.33  			{
    1.34 -				ICollection<IWarFoundryObject> objs = factory.CreateObjectsFromFile(new FileInfo("testdata/multifile-zips/Test.race"));
    1.35 +				ICollection<IWarFoundryObject> objs = factory.CreateObjectsFromFile(new LoadableFileObject("testdata/multifile-zips/Test.race"));
    1.36  				Assert.That(objs, Has.Count(2));
    1.37  				int raceCount = 0;
    1.38  				int systemCount = 0;
    1.39 @@ -65,7 +67,8 @@
    1.40  					{
    1.41  						raceCount++;
    1.42  					}
    1.43 -					else if (obj is GameSystem)
    1.44 +					else
    1.45 +					if (obj is GameSystem)
    1.46  					{
    1.47  						systemCount++;
    1.48  					}
    1.49 @@ -89,7 +92,7 @@
    1.50  			loader.RegisterFactory(factory);
    1.51  			try
    1.52  			{
    1.53 -				ICollection<IWarFoundryObject> objs = factory.CreateObjectsFromFile(new FileInfo("testdata/multifile-zips/Multipack.system"));
    1.54 +				ICollection<IWarFoundryObject> objs = factory.CreateObjectsFromFile(new LoadableFileObject("testdata/multifile-zips/Multipack.system"));
    1.55  				Assert.That(objs, Has.Count(4));
    1.56  				int raceCount = 0;
    1.57  				int systemCount = 0;
    1.58 @@ -100,7 +103,8 @@
    1.59  					{
    1.60  						raceCount++;
    1.61  					}
    1.62 -					else if (obj is GameSystem)
    1.63 +					else
    1.64 +					if (obj is GameSystem)
    1.65  					{
    1.66  						systemCount++;
    1.67  					}