# HG changeset patch # User IBBoard # Date 1299355693 0 # Node ID 45b80fed5e2a689a19221dad1c8a5fbd7dba8ebc # Parent 3c2c108a2f08f66be610942eca24b1463149c0ce Re #324: Add saving of Race and System data to files * Test file extensions for saved zip entries diff -r 3c2c108a2f08 -r 45b80fed5e2a API/Savers/IWarFoundryFileSaverTests.cs --- a/API/Savers/IWarFoundryFileSaverTests.cs Sat Mar 05 19:53:25 2011 +0000 +++ b/API/Savers/IWarFoundryFileSaverTests.cs Sat Mar 05 20:08:13 2011 +0000 @@ -94,11 +94,25 @@ } } } + + [Test()] + public void TestFileExtensionsAreCorrectForType() + { + Assert.That(GetSaver().GetFileExtension(MockArmy.GetMockArmy()), Is.EqualTo(GetArmyExtension())); + Assert.That(GetSaver().GetFileExtension(new MockRace()), Is.EqualTo(GetRaceExtension())); + Assert.That(GetSaver().GetFileExtension(new MockGameSystem()), Is.EqualTo(GetGameSystemExtension())); + } protected abstract IWarFoundryFileSaver GetSaver(); protected abstract string GetEntryName(WarFoundryLoadedObject obj); protected abstract string GetFileExtensionForType(WarFoundryLoadedObject obj); + + protected abstract string GetArmyExtension(); + + protected abstract string GetRaceExtension(); + + protected abstract string GetGameSystemExtension(); } } diff -r 3c2c108a2f08 -r 45b80fed5e2a API/Savers/Xml/WarFoundryXmlFileSaverTests.cs --- a/API/Savers/Xml/WarFoundryXmlFileSaverTests.cs Sat Mar 05 19:53:25 2011 +0000 +++ b/API/Savers/Xml/WarFoundryXmlFileSaverTests.cs Sat Mar 05 20:08:13 2011 +0000 @@ -15,12 +15,29 @@ protected override string GetEntryName (WarFoundryLoadedObject obj) { - return obj.ID; + return obj.ID + GetFileExtensionForType(obj); } protected override string GetFileExtensionForType (WarFoundryLoadedObject obj) { return GetSaver().GetFileExtension(obj); } + + protected override string GetArmyExtension () + { + return ".armyx"; + } + + + protected override string GetRaceExtension () + { + return ".racex"; + } + + + protected override string GetGameSystemExtension () + { + return ".systemx"; + } } }