Inheritance: IFileService
Esempio n. 1
0
 public void should_delete_image()
 {
     IFileService fileService = new FileService(context);
     IImageService service = new ImageService(fileService, context);
     service.Delete(fileName);
     var image = service.Get(fileName, 100, 100, ImageMod.Scale, "FFAADD", null);
     Assert.That(image, Is.Null);
 }
Esempio n. 2
0
        public void should_get_cropped_image()
        {
            IFileService fileService = new FileService(context);
            IImageService service = new ImageService(fileService, context);
            var width = 100;
            var height = 200;

            var image = service.Get(fileName, width, height, ImageMod.Scale, "FFAADD", null);
            image.Save(targetDirectory +  width + "x" + "cropped2" + height + fileName);
            Assert.That(image.Width, Is.EqualTo(width));
            Assert.That(image.Height, Is.EqualTo(height));
        }
Esempio n. 3
0
        public void should_get_image()
        {
            context.Application.Set("Path",imageDirectory);
            IFileService fileService = new FileService(context);
            IImageService service = new ImageService(fileService, context);
            var width = 100;
            var height = 300;

            var image = service.Get(fileName, width, height, ImageMod.Scale, null, null);
            image.Save("imageTransparencyText.bmp");
            Assert.That(image.Width, Is.EqualTo(width));
            Assert.That(image.Height, Is.EqualTo(height));
        }
Esempio n. 4
0
        public void should_get_cached_image()
        {
            IFileService fileService = new FileService(context);
            IImageService service = new ImageService(fileService, context);

            var width = 600;
            var height = 30;
            Assert.That(context.Cache.Count == 0);
            var image = service.GetCached(fileName, width, height, ImageMod.Scale, "FFAADD", null, OutputFormat.Png);
            Assert.That(context.Cache.Count > 0);

            foreach (DictionaryEntry cacheItem in context.Cache)
            {
                Debug.WriteLine(cacheItem.Key);
            }

            image = service.GetCached(fileName, width, height, ImageMod.Scale, "FFAADD", null, OutputFormat.Png);
            Assert.That(image, Is.Not.Null);
        }
Esempio n. 5
0
 public void should_save_image()
 {
     IFileService fileService = new FileService(context);
     IImageService service = new ImageService(fileService, context);
     var isSaved = service.SaveForWeb(fileName, imageDirectory, targetDirectory);
     Assert.That(isSaved);
 }
Esempio n. 6
0
        public void should_save_image_and_create_new_directory()
        {
            IFileService fileService = new FileService(context);
            IImageService service = new ImageService(fileService, context);
            var isSaved = service.SaveForWeb(fileName, rawfilePath, targetDirectory);
            Assert.That(isSaved);

            Assert.That(Directory.Exists(targetDirectory + contentType));
        }