Mercurial > repos > IBBoard.WarFoundry.API.Tests
diff API/Factories/Xml/WarFoundryXmlRaceFactoryTest.cs @ 66:f671ead260b1
Re #290: Migrate to using key/keyref definitions instead of ID/IDREF type
* Move some test data files to sub-folder
* Test duplicate ID validation failures for equipment slots and equipment IDs
* Test valid equipment references
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sun, 04 Jul 2010 14:28:13 +0000 |
parents | fa536aee66d7 |
children | d1d79adcb11d |
line wrap: on
line diff
--- a/API/Factories/Xml/WarFoundryXmlRaceFactoryTest.cs Sun Jul 04 13:53:45 2010 +0000 +++ b/API/Factories/Xml/WarFoundryXmlRaceFactoryTest.cs Sun Jul 04 14:28:13 2010 +0000 @@ -79,6 +79,12 @@ } [Test()] + public void TestCompleteLoadingOnRaceWithDuplicateEquipmentSlotErrors() + { + TestFileValidationFailure("testdata/xml-race-factory/single-unit-with-duplicate-equipment-slot.racex"); + } + + [Test()] public void TestCompleteLoadingOnRaceWithCorrectEquipmentSlotLoads() { SetDefaultGameSystem(); @@ -98,20 +104,36 @@ [Test()] public void TestCompleteLoadingOnRaceWithIncorrectEquipmentIDError() { - TestFileValidationFailure("testdata/single-unit-with-invalid-equipment-reference.racex"); + TestFileValidationFailure("testdata/xml-race-factory/single-unit-with-invalid-equipment-reference.racex"); + } + + [Test()] + public void TestCompleteLoadingOnRaceWithDuplicateEquipmentIDError() + { + TestFileValidationFailure("testdata/xml-race-factory/duplicate-equipment-id.racex"); + } + + [Test()] + public void TestCompleteLoadingOnRaceWithCorrectEquipmentIDLoads() + { + SetDefaultGameSystem(); + FileInfo raceFile = new FileInfo("testdata/xml-race-factory/single-unit-with-valid-equipment-reference.racex"); + Race race = SingleXmlObjectLoader.LoadRaceFromXML(WarFoundryXmlFactory.GetFactory(), raceFile); + UnitType unitType = race.GetUnitType("Empire1"); + Assert.That(unitType.GetEquipmentItem("Empire1equip1"), Is.Not.Null); } [Test()] public void TestCompleteLoadingOnRaceWithIncorrectContainedUnitIDError() { - TestFileValidationFailure("testdata/invalid-contained-unit-reference.racex"); + TestFileValidationFailure("testdata/xml-race-factory/invalid-contained-unit-reference.racex"); } [Test()] public void TestCompleteLoadingOnRaceWithCorrectContainedUnitIDLoadsData() { SetDefaultGameSystem(); - FileInfo raceFile = new FileInfo("testdata/valid-contained-unit-reference.racex"); + FileInfo raceFile = new FileInfo("testdata/xml-race-factory/valid-contained-unit-reference.racex"); Race race = SingleXmlObjectLoader.LoadRaceFromXML(WarFoundryXmlFactory.GetFactory(), raceFile); UnitType unitType = race.GetUnitType("Empire1"); Assert.That(unitType.ContainedUnitTypes, Has.Length(1));