public void ResizeNeededReturnsFalse()
        {
            CreateImage("testImage.png", 500, 700, ImageFormat.Png);
            var filepath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory,
                ConfigurationManager.AppSettings["filePath"], Path.GetFileName("testImage.png"));

            var file = File.ReadAllBytes(filepath);
            Image image;

            using (var imageStream = new MemoryStream(file))
            {
                image = Image.FromStream(imageStream);
            }

            var helper = new ImageHelper();
            var result = helper.ResizeNeeded(image, 500, 700);

            Assert.IsFalse(result);
        }
        public void GetImageReturnsImage()
        {
            CreateImage("testImage.png", 500, 700, ImageFormat.Png);
            var filepath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory,
                ConfigurationManager.AppSettings["filePath"], Path.GetFileName("testImage.png"));

            var file = File.ReadAllBytes(filepath);

            Image expected;

            using (var imageStream = new MemoryStream(file))
            {
                expected = Image.FromStream(imageStream);
            }

            var result = new ImageHelper().GetImage(file);

            Assert.IsNotNull(result);
            Assert.AreEqual(expected.Size, result.Size);
        }
        public void ScaleImageReturnsNewImage()
        {
            CreateImage("testImage.png", 900, 900, ImageFormat.Png);
            var filepath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory,
                ConfigurationManager.AppSettings["filePath"], Path.GetFileName("testImage.png"));

            var file = File.ReadAllBytes(filepath);
            Image image;

            using (var imageStream = new MemoryStream(file))
            {
                image = Image.FromStream(imageStream);
            }

            var scaleRatio = Math.Min((double) 500 / image.Width,
                (double) 700/ image.Height);

            var helper = new ImageHelper();
            var result = helper.ScaleImage(image, scaleRatio);

            Assert.AreNotEqual(image.Size, result.Size);
        }