changeset 94:10da200c7799

Re #324: Add saving of Race and System data to files * Add unit test for file count
author IBBoard <dev@ibboard.co.uk>
date Sat, 05 Mar 2011 15:24:11 +0000
parents 72b2f9a5fe8f
children db6db25921fb
files API/Savers/IWarFoundryFileSaverTests.cs
diffstat 1 files changed, 21 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/API/Savers/IWarFoundryFileSaverTests.cs	Sat Mar 05 15:21:41 2011 +0000
+++ b/API/Savers/IWarFoundryFileSaverTests.cs	Sat Mar 05 15:24:11 2011 +0000
@@ -4,6 +4,7 @@
 using IBBoard.WarFoundry.API.Objects.Mock;
 using NUnit.Framework;
 using ICSharpCode.SharpZipLib.Zip;
+using NUnit.Framework.SyntaxHelpers;
 
 namespace IBBoard.WarFoundry.API.Savers
 {
@@ -47,6 +48,26 @@
 			}
 		}
 		
+		[Test()]
+		public void TestSaverCreatesSingleEntryForOneObject()
+		{
+			string tempFile = Path.GetTempFileName();
+			try
+			{
+				GetSaver().Save(tempFile, new MockGameSystem());
+				ZipFile file = new ZipFile(tempFile);
+				Assert.That(file.Count, Is.EqualTo(1));
+				file.Close();
+			}
+			finally
+			{
+				if (File.Exists(tempFile))
+				{
+					File.Delete(tempFile);
+				}
+			}
+		}
+		
 
 		protected abstract IWarFoundryFileSaver GetSaver();
 	}