changeset 149:71b9364f0276

Re #351: Add extensible requirement handling method * Add test to check type of object
author IBBoard <dev@ibboard.co.uk>
date Mon, 13 Jun 2011 18:59:43 +0000
parents 3561878cdb66
children b86955aa252c
files API/Factories/Xml/WarFoundryXmlRaceFactoryTest.cs
diffstat 1 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/API/Factories/Xml/WarFoundryXmlRaceFactoryTest.cs	Wed Jun 01 20:07:03 2011 +0000
+++ b/API/Factories/Xml/WarFoundryXmlRaceFactoryTest.cs	Mon Jun 13 18:59:43 2011 +0000
@@ -10,6 +10,7 @@
 using IBBoard.WarFoundry.API.Objects;
 using NUnit.Framework;
 using NUnit.Framework.SyntaxHelpers;
+using IBBoard.WarFoundry.API.Objects.Requirement;
 
 namespace IBBoard.WarFoundry.API.Factories.Xml
 {
@@ -358,6 +359,15 @@
 			Assert.That(unitType.GetRequirements(), Has.Length(1));
 		}
 
+		[Test()]
+		public void TestLoadingRequirementType()
+		{
+			SetDefaultGameSystem();
+			Race race = SingleXmlObjectLoader.LoadRaceFromXML(WarFoundryXmlFactory.GetFactory(), new FileInfo("testdata/xml-race-factory/simple-requirement.racex"));
+			UnitType unitType = race.GetUnitType("Empire1");
+			Assert.That(unitType.GetRequirements()[0], Is.InstanceOfType(typeof(UnitRequiresAtLeastNUnitsRequirement)));
+		}
+
 		private void TestFileValidationFailure(string filePath)
 		{
 			SetDefaultGameSystem();