view API/Factories/Xml/WarFoundryXmlSystemFactoryTest.cs @ 67:d3191c44f163

Re #290: Migrate to using key/keyref definitions instead of ID/IDREF type * Add first system factory tests for stats sets
author IBBoard <dev@ibboard.co.uk>
date Sun, 04 Jul 2010 15:05:00 +0000
parents
children a82f164e26e3
line wrap: on
line source

//  This file (WarFoundryXmlSystemFactoryTest.cs) is a part of the IBBoard.WarFoundry.API.Tests project and is copyright 2010 IBBoard
// 
//  // The file and the library/program it is in are licensed and distributed, without warranty, under the GNU Affero GPL license, either version 3 of the License or (at your option) any later version. Please see COPYING for more information and the full license.
using System;
using NUnit.Framework;
using System.IO;
using IBBoard.WarFoundry.API.Objects;
using NUnit.Framework.SyntaxHelpers;

namespace IBBoard.WarFoundry.API.Factories.Xml
{
	[TestFixture()]
	public class WarFoundryXmlSystemFactoryTest
	{
		[Test()]
		public void TestGettingDefaultStatsIDFullyLoadsGameSystem()
		{
			GameSystem system = SingleXmlObjectLoader.LoadGameSystemFromXML(WarFoundryXmlFactory.GetFactory(), new FileInfo("testdata/xml-system-factory/valid-default-stats-one-stats-set.systemx"));
			Assert.That(system.IsFullyLoaded, Is.False);
			string temp = system.StandardSystemStatsID;
			Assert.That(system.IsFullyLoaded, Is.True);
		}
		
		[Test()]
		public void TestValidDefaultStatsIDLoadsCorrectly()
		{
			GameSystem system = SingleXmlObjectLoader.LoadGameSystemFromXML(WarFoundryXmlFactory.GetFactory(), new FileInfo("testdata/xml-system-factory/valid-default-stats-one-stats-set.systemx"));
			Assert.That(system.StandardSystemStatsID, Is.EqualTo("defaultStats"));
			Assert.That(system.SystemStats, Has.Length(1));
		}
		
		[Test()]
		public void TestValidDefaultStatsIDLoadsCorrectlyWithMultipleStatsSets()
		{
			GameSystem system = SingleXmlObjectLoader.LoadGameSystemFromXML(WarFoundryXmlFactory.GetFactory(), new FileInfo("testdata/xml-system-factory/valid-default-stats-multiple-stats-set.systemx"));
			Assert.That(system.StandardSystemStatsID, Is.EqualTo("defaultStats"));
			Assert.That(system.SystemStats, Has.Length(2));
		}
	}
}