diff API/Savers/IWarFoundryFileSaverTests.cs @ 91:98539b2fe8fa

Re #324: Add saving of Race and System data to files * Add first unit test for file savers
author IBBoard <dev@ibboard.co.uk>
date Sat, 05 Mar 2011 14:59:04 +0000
parents
children 43c44d0bf97f
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/API/Savers/IWarFoundryFileSaverTests.cs	Sat Mar 05 14:59:04 2011 +0000
@@ -0,0 +1,31 @@
+using System;
+using System.IO;
+using IBBoard.WarFoundry.API.Objects;
+using IBBoard.WarFoundry.API.Objects.Mock;
+using NUnit.Framework;
+
+namespace IBBoard.WarFoundry.API.Savers
+{
+	public abstract class IWarFoundryFileSaverTests
+	{
+		[Test()]
+		public void TestSaverCreatesZipFile()
+		{
+			string tempFile = Path.GetTempFileName();
+			try
+			{
+				GetSaver().Save(tempFile, new MockGameSystem());
+				Assert.That(File.Exists(tempFile));
+			}
+			finally
+			{
+				if (File.Exists(tempFile))
+				{
+					File.Delete(tempFile);
+				}
+			}
+		}
+
+		protected abstract IWarFoundryFileSaver GetSaver();
+	}
+}