changeset 97:45b80fed5e2a

Re #324: Add saving of Race and System data to files * Test file extensions for saved zip entries
author IBBoard <dev@ibboard.co.uk>
date Sat, 05 Mar 2011 20:08:13 +0000
parents 3c2c108a2f08
children 49c5e24decb9
files API/Savers/IWarFoundryFileSaverTests.cs API/Savers/Xml/WarFoundryXmlFileSaverTests.cs
diffstat 2 files changed, 32 insertions(+), 1 deletions(-) [+]
line diff
     1.1 --- a/API/Savers/IWarFoundryFileSaverTests.cs	Sat Mar 05 19:53:25 2011 +0000
     1.2 +++ b/API/Savers/IWarFoundryFileSaverTests.cs	Sat Mar 05 20:08:13 2011 +0000
     1.3 @@ -94,11 +94,25 @@
     1.4  				}
     1.5  			}
     1.6  		}
     1.7 +		
     1.8 +		[Test()]
     1.9 +		public void TestFileExtensionsAreCorrectForType()
    1.10 +		{
    1.11 +			Assert.That(GetSaver().GetFileExtension(MockArmy.GetMockArmy()), Is.EqualTo(GetArmyExtension()));
    1.12 +			Assert.That(GetSaver().GetFileExtension(new MockRace()), Is.EqualTo(GetRaceExtension()));
    1.13 +			Assert.That(GetSaver().GetFileExtension(new MockGameSystem()), Is.EqualTo(GetGameSystemExtension()));
    1.14 +		}
    1.15  
    1.16  		protected abstract IWarFoundryFileSaver GetSaver();
    1.17  
    1.18  		protected abstract string GetEntryName(WarFoundryLoadedObject obj);
    1.19  
    1.20  		protected abstract string GetFileExtensionForType(WarFoundryLoadedObject obj);
    1.21 +		
    1.22 +		protected abstract string GetArmyExtension();
    1.23 +		
    1.24 +		protected abstract string GetRaceExtension();
    1.25 +		
    1.26 +		protected abstract string GetGameSystemExtension();
    1.27  	}
    1.28  }
     2.1 --- a/API/Savers/Xml/WarFoundryXmlFileSaverTests.cs	Sat Mar 05 19:53:25 2011 +0000
     2.2 +++ b/API/Savers/Xml/WarFoundryXmlFileSaverTests.cs	Sat Mar 05 20:08:13 2011 +0000
     2.3 @@ -15,12 +15,29 @@
     2.4  		
     2.5  		protected override string GetEntryName (WarFoundryLoadedObject obj)
     2.6  		{
     2.7 -			return obj.ID;
     2.8 +			return obj.ID + GetFileExtensionForType(obj);
     2.9  		}
    2.10  		
    2.11  		protected override string GetFileExtensionForType (WarFoundryLoadedObject obj)
    2.12  		{
    2.13  			return GetSaver().GetFileExtension(obj);
    2.14  		}
    2.15 +
    2.16 +		protected override string GetArmyExtension ()
    2.17 +		{
    2.18 +			return ".armyx";
    2.19 +		}
    2.20 +		
    2.21 +		
    2.22 +		protected override string GetRaceExtension ()
    2.23 +		{
    2.24 +			return ".racex";
    2.25 +		}
    2.26 +		
    2.27 +		
    2.28 +		protected override string GetGameSystemExtension ()
    2.29 +		{
    2.30 +			return ".systemx";
    2.31 +		}
    2.32  	}
    2.33  }