changeset 86:d1ec7618f812

Fixes #318: DefaultWarFoundryLoader throws null ref when loading individual files * Add unit test for loading a single file
author IBBoard <dev@ibboard.co.uk>
date Wed, 23 Feb 2011 20:37:59 +0000
parents 052148dc0a2f
children 5c04db41d643
files API/WarFoundryLoaderTest.cs
diffstat 1 files changed, 12 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/API/WarFoundryLoaderTest.cs	Sun Feb 20 20:43:50 2011 +0000
+++ b/API/WarFoundryLoaderTest.cs	Wed Feb 23 20:37:59 2011 +0000
@@ -7,6 +7,9 @@
 using NUnit.Framework;
 using IBBoard.WarFoundry.API.Factories.Mock;
 using IBBoard.WarFoundry.API.Objects;
+using NUnit.Framework.SyntaxHelpers;
+using System.Collections.Generic;
+using IBBoard.WarFoundry.API.Factories.Xml;
 
 namespace IBBoard.WarFoundry.API.Factories
 {
@@ -33,6 +36,15 @@
 			loader.RemoveLoadDirectory(dir);
 			loader.UnregisterFactory(GetSystemFactory());
 		}
+		
+		[Test()]
+		public void TestBug318LoadingSingleFileShouldNotNullRef()
+		{
+			DefaultWarFoundryLoader loader = new DefaultWarFoundryLoader();
+			loader.RegisterFactory(WarFoundryXmlFactory.GetFactory());
+			ICollection<IWarFoundryObject> objs = loader.LoadFile(new FileInfo("testdata/Test.system"));
+			Assert.That(objs, Has.Count(1));
+		}
 				
 		private AbstractNativeWarFoundryFactory GetSystemFactory()
 		{