Exemple #1
0
 public MessageAdapter(
     IMappingEngine mappingEngine,
     QueueUtilizerFactory queueUtilizerFactory,
     ImagePrinter imagePrinter,
     ImageService imageService,
     PatternViewModelProvider patternViewModelProvider,
      ImageUtils imageUtils)
 {
     _mappingEngine = mappingEngine;
     _queueUtilizer = queueUtilizerFactory.CreateQueue<InstagramMessageDto>();
     _imagePrinter = imagePrinter;
     _imageService = imageService;
     _patternVmProvider = patternViewModelProvider;
     _imageUtils = imageUtils;
 }
 public CameraResultViewModel(
     IViewModelNavigator navigator, 
     ImagePrinter printer, 
     SettingsProvider settingsProvider,
     ImageService imageService,
     CompositionProcessingResult result)
 {
     _navigator = navigator;
     _printer = printer;
     _imageService = imageService;
     Image = result.ImageResult;
     _copiesCount = 1;
     var appSettings = settingsProvider.GetAppSettings();
     if (appSettings != null)
     {
         _maxCopies = appSettings.MaxPrinterCopies;
         _printerName = appSettings.PrinterName;
     }
 }
        public void SavesImage_ValidImaeg_DoesNotThrow()
        {
            string filePath = @"C:\Users\Дмитрий\Desktop\India\индия\агра и варанаси\DSC_0002.jpg";
            byte[] data = File.ReadAllBytes(filePath);

            ImageRepository rep = new ImageRepository(_context);
            Session session = new Session() { StartTime = DateTime.Now };
            _context.Sessions.Add(session);
            _context.SaveChanges();

            var imageService = new ImageService(rep);

            imageService.SaveImage(new ImageViewModel(data));

            string baseDir = AppDomain.CurrentDomain.BaseDirectory;

            Assert.IsNotEmpty(Directory.EnumerateFiles(string.Format("{0}/Images/{1}", baseDir, session.StartTime.ToString("dd_MM_yyyy") + "_" +  session.Id), "*.png"));
            Assert.IsNotNull(_context.Images.FirstOrDefault());
        }