# HG changeset patch # User IBBoard # Date 1276974547 0 # Node ID 27625216d8d6d7d243e425f242e13340d1dfe3f3 # Parent f2348c00e6334eb24c7e75bcd3cbc1d3f0f3126c 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 diff -r f2348c00e633 -r 27625216d8d6 API/Factories/Xml/WarFoundryXmlRaceFactoryTest.cs --- 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() diff -r f2348c00e633 -r 27625216d8d6 IBBoard.WarFoundry.API.Tests.csproj --- a/IBBoard.WarFoundry.API.Tests.csproj Sat Jun 19 15:50:35 2010 +0000 +++ b/IBBoard.WarFoundry.API.Tests.csproj Sat Jun 19 19:09:07 2010 +0000 @@ -76,9 +76,6 @@ PreserveNewest - - PreserveNewest - PreserveNewest @@ -164,6 +161,12 @@ PreserveNewest + + PreserveNewest + + + PreserveNewest + @@ -195,5 +198,6 @@ + \ No newline at end of file diff -r f2348c00e633 -r 27625216d8d6 testdata/race-with-non-existant-ability.racex --- a/testdata/race-with-non-existant-ability.racex Sat Jun 19 15:50:35 2010 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +0,0 @@ - - - - - - 4 - 6 - 6 - 4 - 4 - 3 - 6 - 4 - 9 - - - - - - - - - - - - - - - - - \ No newline at end of file diff -r f2348c00e633 -r 27625216d8d6 testdata/xml-race-factory/existing-ability.racex --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testdata/xml-race-factory/existing-ability.racex Sat Jun 19 19:09:07 2010 +0000 @@ -0,0 +1,26 @@ + + + + + + 4 + 6 + 6 + 4 + 4 + 3 + 6 + 4 + 9 + + + + + + + + + All men will follow the character and can use his leadership + + + \ No newline at end of file diff -r f2348c00e633 -r 27625216d8d6 testdata/xml-race-factory/non-existant-ability.racex --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testdata/xml-race-factory/non-existant-ability.racex Sat Jun 19 19:09:07 2010 +0000 @@ -0,0 +1,21 @@ + + + + + + 4 + 6 + 6 + 4 + 4 + 3 + 6 + 4 + 9 + + + + + + + \ No newline at end of file