Mercurial > repos > IBBoard.WarFoundry.API.Tests
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 wrap: on
line diff
--- a/API/Savers/IWarFoundryFileSaverTests.cs Sat Mar 05 14:59:04 2011 +0000 +++ b/API/Savers/IWarFoundryFileSaverTests.cs Sat Mar 05 15:11:24 2011 +0000 @@ -3,18 +3,20 @@ using IBBoard.WarFoundry.API.Objects; using IBBoard.WarFoundry.API.Objects.Mock; using NUnit.Framework; +using ICSharpCode.SharpZipLib.Zip; namespace IBBoard.WarFoundry.API.Savers { public abstract class IWarFoundryFileSaverTests { [Test()] - public void TestSaverCreatesZipFile() + public void TestSaverCreatesFile() { string tempFile = Path.GetTempFileName(); try { - GetSaver().Save(tempFile, new MockGameSystem()); + bool saved = GetSaver().Save(tempFile, new MockGameSystem()); + Assert.That(saved); Assert.That(File.Exists(tempFile)); } finally @@ -25,6 +27,25 @@ } } } + + [Test()] + public void TestSaverCreatesZipFile() + { + string tempFile = Path.GetTempFileName(); + try + { + GetSaver().Save(tempFile, new MockGameSystem()); + new ZipFile(tempFile); + } + finally + { + if (File.Exists(tempFile)) + { + File.Delete(tempFile); + } + } + } + protected abstract IWarFoundryFileSaver GetSaver(); }