Browse Source

Adds tests for saving the files

Former-commit-id: 7893eb70f8315cf13da030fde6a4a3c9884f59aa
pull/17/head
Thomas Broust 12 years ago
parent
commit
f3a5cc25ba
  1. 39
      src/ImageProcessor.UnitTests/ImageFactoryUnitTests.cs

39
src/ImageProcessor.UnitTests/ImageFactoryUnitTests.cs

@ -60,6 +60,45 @@ namespace ImageProcessor.UnitTests
}
}
/// <summary>
/// Tests that the save method actually saves a file
/// </summary>
[Test]
public void TestSaveToDisk()
{
foreach (var fileName in ListInputFiles())
{
var outputFileName = string.Format("./output/{0}", Path.GetFileName(fileName));
using (var imageFactory = new ImageFactory())
{
imageFactory.Load(fileName);
imageFactory.Save(outputFileName);
Assert.AreEqual(true, File.Exists(outputFileName));
}
}
}
/// <summary>
/// Tests that the save method actually writes to memory
/// </summary>
[Test]
public void TestSaveToMemory()
{
foreach (var fileName in ListInputFiles())
{
using (var imageFactory = new ImageFactory())
{
imageFactory.Load(fileName);
using (var s = new MemoryStream())
{
imageFactory.Save(s);
s.Seek(0, SeekOrigin.Begin);
Assert.AreEqual(true, s.Capacity > 0);
}
}
}
}
/// <summary>
/// Tests that a filter is really applied by checking that the image is modified
/// </summary>

Loading…
Cancel
Save