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 wrap: on
line diff
--- 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();
 	}
 }
--- 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";
+		}
 	}
 }