public MonitoringService( SettingsProvider settingsProvider, MessageAdapter messageAdapter, InstagramExplorer instagramExplorer, ImageUtils imageUtils, IImageRepository imageRep) { _messageAdapter = messageAdapter; _instagramExplorer = instagramExplorer; _imageUtils = imageUtils; _imageRep = imageRep; AppSettingsDto settings = settingsProvider.GetAppSettings(); if (settings == null) throw new InvalidOperationException(); _hashTag = settings.HashTag; var startSessionTime = imageRep.GetActiveSession(includeImages: false); if (startSessionTime == null) imageRep.StartSession(); _startTime = startSessionTime?.StartTime ?? DateTime.Now; _endTime = settings.DateEnd; _printerName = settings.PrinterName; }
public void TestGetImagesByUserName_UserExists_ReturnsValidImages() { var explorer = new InstagramExplorer(); var images = explorer.GetImagesByUserName("jlo", null, new CancellationToken()).Result; Assert.IsTrue(images != null && images.Images != null && images.Images.Any() && images.Images.All(x => x.Data != null)); }
public void TestGetImagesByHashTag_AnyState_ReturnsValidImages() { var explorer = new InstagramExplorer(); var images = explorer.GetImagesByHashTag("wedding", null, new CancellationToken(),15).Result; Assert.IsTrue(images != null && images.Images != null && images.Images.Any() && images.Images.All(x => x.Data != null)); }
public InstagramExplorerViewModel( IViewModelNavigator navigator, InstagramExplorer instagramExplorer, SettingsProvider settings, ImagePrinter printer, PatternViewModelProvider patternVMProvider, ImageUtils imageUtils, IMappingEngine mappingEngine) { _navigator = navigator; _printer = printer; _patternVmProvider = patternVMProvider; _imageUtils = imageUtils; _mappingEngine = mappingEngine; _instagramExplorer = instagramExplorer; AppSettingsDto appSettings = settings.GetAppSettings(); if (appSettings != null) _printerName = appSettings.PrinterName; IsHashTag = true; SearchAsyncOperation= new NotifyTaskCompletion<ImageResponse>(Task.FromResult(default(ImageResponse))); _searchTokenSource= new CancellationTokenSource(); }