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 diff
     1.1 --- a/API/WarFoundryLoaderTest.cs	Sun Feb 20 20:43:50 2011 +0000
     1.2 +++ b/API/WarFoundryLoaderTest.cs	Wed Feb 23 20:37:59 2011 +0000
     1.3 @@ -7,6 +7,9 @@
     1.4  using NUnit.Framework;
     1.5  using IBBoard.WarFoundry.API.Factories.Mock;
     1.6  using IBBoard.WarFoundry.API.Objects;
     1.7 +using NUnit.Framework.SyntaxHelpers;
     1.8 +using System.Collections.Generic;
     1.9 +using IBBoard.WarFoundry.API.Factories.Xml;
    1.10  
    1.11  namespace IBBoard.WarFoundry.API.Factories
    1.12  {
    1.13 @@ -33,6 +36,15 @@
    1.14  			loader.RemoveLoadDirectory(dir);
    1.15  			loader.UnregisterFactory(GetSystemFactory());
    1.16  		}
    1.17 +		
    1.18 +		[Test()]
    1.19 +		public void TestBug318LoadingSingleFileShouldNotNullRef()
    1.20 +		{
    1.21 +			DefaultWarFoundryLoader loader = new DefaultWarFoundryLoader();
    1.22 +			loader.RegisterFactory(WarFoundryXmlFactory.GetFactory());
    1.23 +			ICollection<IWarFoundryObject> objs = loader.LoadFile(new FileInfo("testdata/Test.system"));
    1.24 +			Assert.That(objs, Has.Count(1));
    1.25 +		}
    1.26  				
    1.27  		private AbstractNativeWarFoundryFactory GetSystemFactory()
    1.28  		{