# HG changeset patch # User IBBoard # Date 1274208027 0 # Node ID b4b4bde843d7a3d24850425563bed07bf97f4c40 # Parent 73308371f9d8592f2a4171c4dc0d1354aae07020 Re #274: crash when missing unitMember id * Tests and test data for unit member crash. Schema should be able to validate using key/keyref, but can't get it working at the moment. diff -r 73308371f9d8 -r b4b4bde843d7 API/Factories/Xml/WarFoundryXmlRaceFactoryTest.cs --- a/API/Factories/Xml/WarFoundryXmlRaceFactoryTest.cs Mon May 17 20:04:13 2010 +0000 +++ b/API/Factories/Xml/WarFoundryXmlRaceFactoryTest.cs Tue May 18 18:40:27 2010 +0000 @@ -2,14 +2,11 @@ // // The file and the library/program it is in are licensed and distributed, without warranty, under the GNU Affero GPL license, either version 3 of the License or (at your option) any later version. Please see COPYING for more information and the full license. -using System; +using IBBoard.IO; +using IBBoard.WarFoundry.API.Objects; +using NUnit.Framework; using System.Collections.Generic; using System.IO; -using System.Xml; -using NUnit.Framework; -using IBBoard.WarFoundry.API.Objects; -using IBBoard.WarFoundry.API.Objects.Mock; -using IBBoard.IO; namespace IBBoard.WarFoundry.API.Factories.Xml { @@ -43,6 +40,16 @@ Race race = SingleXmlObjectLoader.LoadRaceFromXML(WarFoundryXmlFactory.GetFactory(), raceFile); race.EnsureFullyLoaded(); } + + [Test()] + [ExpectedException(typeof(InvalidFileException), ExpectedMessage = "TBD")] + public void TestCompleteLoadingOnRaceWithIncorrectEquipmentSlotErrors() + { + SetDefaultGameSystem(); + FileInfo raceFile = new FileInfo("testdata/single-unit-with-invalid-equipment-reference.racex"); + Race race = SingleXmlObjectLoader.LoadRaceFromXML(WarFoundryXmlFactory.GetFactory(), raceFile); + race.EnsureFullyLoaded(); + } [Test()] [ExpectedException(typeof(InvalidFileException), ExpectedMessage="Referenced game system, 'nonexistant-system', did not exist")] @@ -147,9 +154,8 @@ } private static void SetDefaultGameSystem() - { - FileInfo systemFile = new FileInfo("testdata/default.systemx"); - SetDefaultGameSystem(systemFile); + { + SetDefaultGameSystem(new FileInfo("testdata/default.systemx")); } public static void SetDefaultGameSystem(FileInfo systemFile) diff -r 73308371f9d8 -r b4b4bde843d7 IBBoard.WarFoundry.API.Tests.csproj --- a/IBBoard.WarFoundry.API.Tests.csproj Mon May 17 20:04:13 2010 +0000 +++ b/IBBoard.WarFoundry.API.Tests.csproj Tue May 18 18:40:27 2010 +0000 @@ -109,6 +109,9 @@ PreserveNewest + + PreserveNewest + diff -r 73308371f9d8 -r b4b4bde843d7 testdata/single-unit-multi-type-referencing-race-with-override.racex --- a/testdata/single-unit-multi-type-referencing-race-with-override.racex Mon May 17 20:04:13 2010 +0000 +++ b/testdata/single-unit-multi-type-referencing-race-with-override.racex Tue May 18 18:40:27 2010 +0000 @@ -20,7 +20,7 @@ - + 4 6 @@ -33,7 +33,7 @@ 9 - + 8 3 diff -r 73308371f9d8 -r b4b4bde843d7 testdata/single-unit-multi-type-referencing-race.racex --- a/testdata/single-unit-multi-type-referencing-race.racex Mon May 17 20:04:13 2010 +0000 +++ b/testdata/single-unit-multi-type-referencing-race.racex Tue May 18 18:40:27 2010 +0000 @@ -9,7 +9,7 @@ - + 4 6 @@ -22,7 +22,7 @@ 9 - + 8 3 diff -r 73308371f9d8 -r b4b4bde843d7 testdata/single-unit-non-existant-type-referencing-race.racex --- a/testdata/single-unit-non-existant-type-referencing-race.racex Mon May 17 20:04:13 2010 +0000 +++ b/testdata/single-unit-non-existant-type-referencing-race.racex Tue May 18 18:40:27 2010 +0000 @@ -8,7 +8,7 @@ - + 4 6 diff -r 73308371f9d8 -r b4b4bde843d7 testdata/single-unit-type-referencing-race.racex --- a/testdata/single-unit-type-referencing-race.racex Mon May 17 20:04:13 2010 +0000 +++ b/testdata/single-unit-type-referencing-race.racex Tue May 18 18:40:27 2010 +0000 @@ -8,7 +8,7 @@ - + 4 6 diff -r 73308371f9d8 -r b4b4bde843d7 testdata/single-unit-with-invalid-equipment-reference.racex --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testdata/single-unit-with-invalid-equipment-reference.racex Tue May 18 18:40:27 2010 +0000 @@ -0,0 +1,27 @@ + + + + + + 4 + 6 + 6 + 4 + 4 + 3 + 6 + 4 + 9 + + + + + + + + + + + + + \ No newline at end of file