diff API/Factories/Xml/WarFoundryXmlRaceFactoryTest.cs @ 61:27625216d8d6

Re #290: Migrate to using key/keyref definitions instead of ID/IDREF type * Add test for ability loading and validation when the ability exists * Move old test data for non-existant ability into sub-folder
author IBBoard <dev@ibboard.co.uk>
date Sat, 19 Jun 2010 19:09:07 +0000
parents f2348c00e633
children ef8950a5f4cb
line wrap: on
line diff
--- a/API/Factories/Xml/WarFoundryXmlRaceFactoryTest.cs	Sat Jun 19 15:50:35 2010 +0000
+++ b/API/Factories/Xml/WarFoundryXmlRaceFactoryTest.cs	Sat Jun 19 19:09:07 2010 +0000
@@ -29,7 +29,7 @@
 		public void TestCompleteLoadingOnRaceWithMissingAbilityIdErrors()
 		{
 			SetDefaultGameSystem();
-			FileInfo raceFile = new FileInfo("testdata/race-with-non-existant-ability.racex");
+			FileInfo raceFile = new FileInfo("testdata/xml-race-factory/non-existant-ability.racex");
 			
 			try
 			{
@@ -43,6 +43,20 @@
 				Assert.That(innerException, Is.InstanceOfType(typeof(XmlSchemaValidationException)));
 			}
 		}
+
+		[Test()]
+		public void TestCompleteLoadingOnRaceWithAbilityLoadsData()
+		{
+			SetDefaultGameSystem();
+			FileInfo raceFile = new FileInfo("testdata/xml-race-factory/existing-ability.racex");
+			Race race = SingleXmlObjectLoader.LoadRaceFromXML(WarFoundryXmlFactory.GetFactory(), raceFile);
+			UnitType unitType = race.GetUnitType("Empire1");
+			Ability ability = race.GetAbility("leaderOfMen");
+			Assert.That(ability.Name, Is.EqualTo("Leader of Men"));
+			Assert.That(ability.Description, Is.EqualTo("All men will follow the character and can use his leadership"));
+			Assert.That(unitType.GetRequiredAbilities(), Has.Member(ability));
+			
+		}
 		
 		[Test()]
 		public void TestCompleteLoadingOnRaceWithIncorrectMemberTypeIDError()