changeset 92:43c44d0bf97f

Re #324: Add saving of Race and System data to files * Add test to make sure file is a zip (native format)
author IBBoard <dev@ibboard.co.uk>
date Sat, 05 Mar 2011 15:11:24 +0000
parents 98539b2fe8fa
children 72b2f9a5fe8f
files API/Savers/IWarFoundryFileSaverTests.cs
diffstat 1 files changed, 23 insertions(+), 2 deletions(-) [+]
line diff
     1.1 --- a/API/Savers/IWarFoundryFileSaverTests.cs	Sat Mar 05 14:59:04 2011 +0000
     1.2 +++ b/API/Savers/IWarFoundryFileSaverTests.cs	Sat Mar 05 15:11:24 2011 +0000
     1.3 @@ -3,18 +3,20 @@
     1.4  using IBBoard.WarFoundry.API.Objects;
     1.5  using IBBoard.WarFoundry.API.Objects.Mock;
     1.6  using NUnit.Framework;
     1.7 +using ICSharpCode.SharpZipLib.Zip;
     1.8  
     1.9  namespace IBBoard.WarFoundry.API.Savers
    1.10  {
    1.11  	public abstract class IWarFoundryFileSaverTests
    1.12  	{
    1.13  		[Test()]
    1.14 -		public void TestSaverCreatesZipFile()
    1.15 +		public void TestSaverCreatesFile()
    1.16  		{
    1.17  			string tempFile = Path.GetTempFileName();
    1.18  			try
    1.19  			{
    1.20 -				GetSaver().Save(tempFile, new MockGameSystem());
    1.21 +				bool saved = GetSaver().Save(tempFile, new MockGameSystem());
    1.22 +				Assert.That(saved);
    1.23  				Assert.That(File.Exists(tempFile));
    1.24  			}
    1.25  			finally
    1.26 @@ -25,6 +27,25 @@
    1.27  				}
    1.28  			}
    1.29  		}
    1.30 +		
    1.31 +		[Test()]
    1.32 +		public void TestSaverCreatesZipFile()
    1.33 +		{
    1.34 +			string tempFile = Path.GetTempFileName();
    1.35 +			try
    1.36 +			{
    1.37 +				GetSaver().Save(tempFile, new MockGameSystem());
    1.38 +				new ZipFile(tempFile);
    1.39 +			}
    1.40 +			finally
    1.41 +			{
    1.42 +				if (File.Exists(tempFile))
    1.43 +				{
    1.44 +					File.Delete(tempFile);
    1.45 +				}
    1.46 +			}
    1.47 +		}
    1.48 +		
    1.49  
    1.50  		protected abstract IWarFoundryFileSaver GetSaver();
    1.51  	}