// -------------------------------------------------------------------------------------------------------------------- // // Copyright (c) James South. // Licensed under the Apache License, Version 2.0. // // // Unit tests for the ImageFactory (loading of images) // // -------------------------------------------------------------------------------------------------------------------- namespace ImageProcessor.UnitTests { using System; using System.IO; using NUnit.Framework; /// /// Test harness for the image factory /// [TestFixture] public class ImageFactoryUnitTests { /// /// The path to the binary's folder /// private readonly string localPath = Path.GetDirectoryName(new Uri(System.Reflection.Assembly.GetExecutingAssembly().CodeBase).LocalPath); /// /// Tests the loading of image from a file /// [Test] public void TestLoadImageFromFile() { var testPhoto = Path.Combine(this.localPath, "Images/Chrysanthemum.jpg"); using (ImageFactory imageFactory = new ImageFactory()) { imageFactory.Load(testPhoto); Assert.AreEqual(testPhoto, imageFactory.ImagePath); Assert.AreEqual("image/jpeg", imageFactory.MimeType); } } } }