Mercurial > repos > IBDev-IBBoard.WarFoundry.API.Tests
comparison 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 |
comparison
equal
deleted
inserted
replaced
202:49e50238c380 | 203:2b27447ae74e |
---|---|
369 [Test()] | 369 [Test()] |
370 public void TestLoadingRequirementType() | 370 public void TestLoadingRequirementType() |
371 { | 371 { |
372 SetDefaultGameSystem(); | 372 SetDefaultGameSystem(); |
373 Race race = SingleXmlObjectLoader.LoadRaceFromXML(WarFoundryXmlFactory.GetFactory(), new FileInfo("testdata/xml-race-factory/simple-requirement.racex")); | 373 Race race = SingleXmlObjectLoader.LoadRaceFromXML(WarFoundryXmlFactory.GetFactory(), new FileInfo("testdata/xml-race-factory/simple-requirement.racex")); |
374 UnitType unitType = race.GetUnitType("Empire1"); | |
375 Assert.That(unitType.GetRequirements()[0], Is.InstanceOfType(typeof(UnitRequiresAtLeastNUnitsRequirement))); | |
376 } | |
377 | |
378 [Test] | |
379 public void TestCyclicReferenceDoesNotCrash() | |
380 { | |
381 SetDefaultGameSystem(); | |
382 Race race = SingleXmlObjectLoader.LoadRaceFromXML(WarFoundryXmlFactory.GetFactory(), new FileInfo("testdata/xml-race-factory/cyclic.racex")); | |
374 UnitType unitType = race.GetUnitType("Empire1"); | 383 UnitType unitType = race.GetUnitType("Empire1"); |
375 Assert.That(unitType.GetRequirements()[0], Is.InstanceOfType(typeof(UnitRequiresAtLeastNUnitsRequirement))); | 384 Assert.That(unitType.GetRequirements()[0], Is.InstanceOfType(typeof(UnitRequiresAtLeastNUnitsRequirement))); |
376 } | 385 } |
377 | 386 |
378 private void TestFileValidationFailure(string filePath) | 387 private void TestFileValidationFailure(string filePath) |