diff API/Factories/Xml/WarFoundryXmlRaceFactoryTest.cs @ 203:2b27447ae74e

Re #352: Test/fix cyclic references in unit types * Add test case
author IBBoard <dev@ibboard.co.uk>
date Sat, 21 Jan 2012 21:01:02 +0000
parents d0b8c43f705f
children ea104de9189e
line wrap: on
line diff
--- a/API/Factories/Xml/WarFoundryXmlRaceFactoryTest.cs	Fri Dec 23 15:33:53 2011 +0000
+++ b/API/Factories/Xml/WarFoundryXmlRaceFactoryTest.cs	Sat Jan 21 21:01:02 2012 +0000
@@ -375,6 +375,15 @@
 			Assert.That(unitType.GetRequirements()[0], Is.InstanceOfType(typeof(UnitRequiresAtLeastNUnitsRequirement)));
 		}
 
+		[Test]
+		public void TestCyclicReferenceDoesNotCrash()
+		{
+			SetDefaultGameSystem();
+			Race race = SingleXmlObjectLoader.LoadRaceFromXML(WarFoundryXmlFactory.GetFactory(), new FileInfo("testdata/xml-race-factory/cyclic.racex"));
+			UnitType unitType = race.GetUnitType("Empire1");
+			Assert.That(unitType.GetRequirements()[0], Is.InstanceOfType(typeof(UnitRequiresAtLeastNUnitsRequirement)));
+		}
+
 		private void TestFileValidationFailure(string filePath)
 		{
 			SetDefaultGameSystem();