Browse Source

Adds tests for saving the files

Former-commit-id: 2d2321ed506c26afc555fd7d61d2561aca5d5659
pull/17/head
Thomas Broust 12 years ago
parent
commit
3280af906a
  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