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 diff
     1.1 --- a/API/Factories/Xml/WarFoundryXmlRaceFactoryTest.cs	Wed Jun 01 20:07:03 2011 +0000
     1.2 +++ b/API/Factories/Xml/WarFoundryXmlRaceFactoryTest.cs	Mon Jun 13 18:59:43 2011 +0000
     1.3 @@ -10,6 +10,7 @@
     1.4  using IBBoard.WarFoundry.API.Objects;
     1.5  using NUnit.Framework;
     1.6  using NUnit.Framework.SyntaxHelpers;
     1.7 +using IBBoard.WarFoundry.API.Objects.Requirement;
     1.8  
     1.9  namespace IBBoard.WarFoundry.API.Factories.Xml
    1.10  {
    1.11 @@ -358,6 +359,15 @@
    1.12  			Assert.That(unitType.GetRequirements(), Has.Length(1));
    1.13  		}
    1.14  
    1.15 +		[Test()]
    1.16 +		public void TestLoadingRequirementType()
    1.17 +		{
    1.18 +			SetDefaultGameSystem();
    1.19 +			Race race = SingleXmlObjectLoader.LoadRaceFromXML(WarFoundryXmlFactory.GetFactory(), new FileInfo("testdata/xml-race-factory/simple-requirement.racex"));
    1.20 +			UnitType unitType = race.GetUnitType("Empire1");
    1.21 +			Assert.That(unitType.GetRequirements()[0], Is.InstanceOfType(typeof(UnitRequiresAtLeastNUnitsRequirement)));
    1.22 +		}
    1.23 +
    1.24  		private void TestFileValidationFailure(string filePath)
    1.25  		{
    1.26  			SetDefaultGameSystem();