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 diff
     1.1 --- a/API/Savers/IWarFoundryFileSaverTests.cs	Sat Mar 05 15:21:41 2011 +0000
     1.2 +++ b/API/Savers/IWarFoundryFileSaverTests.cs	Sat Mar 05 15:24:11 2011 +0000
     1.3 @@ -4,6 +4,7 @@
     1.4  using IBBoard.WarFoundry.API.Objects.Mock;
     1.5  using NUnit.Framework;
     1.6  using ICSharpCode.SharpZipLib.Zip;
     1.7 +using NUnit.Framework.SyntaxHelpers;
     1.8  
     1.9  namespace IBBoard.WarFoundry.API.Savers
    1.10  {
    1.11 @@ -47,6 +48,26 @@
    1.12  			}
    1.13  		}
    1.14  		
    1.15 +		[Test()]
    1.16 +		public void TestSaverCreatesSingleEntryForOneObject()
    1.17 +		{
    1.18 +			string tempFile = Path.GetTempFileName();
    1.19 +			try
    1.20 +			{
    1.21 +				GetSaver().Save(tempFile, new MockGameSystem());
    1.22 +				ZipFile file = new ZipFile(tempFile);
    1.23 +				Assert.That(file.Count, Is.EqualTo(1));
    1.24 +				file.Close();
    1.25 +			}
    1.26 +			finally
    1.27 +			{
    1.28 +				if (File.Exists(tempFile))
    1.29 +				{
    1.30 +					File.Delete(tempFile);
    1.31 +				}
    1.32 +			}
    1.33 +		}
    1.34 +		
    1.35  
    1.36  		protected abstract IWarFoundryFileSaver GetSaver();
    1.37  	}