public IObservable <ISavedImage> StartSavingImages(IImageSources imageSources) { IConnectableObservable <ISavedImage> saves = imageSources.ImagesFromAllSources .Select(i => Observable.FromAsync(() => SaveImage(i.Image, i.SourceId))) .Concat() .Publish(); _saveSubscriptions.Add(saves.Connect()); return(saves); }
public WallrApplication(ISetup setup, ILogger logger, IEnumerable <IQuickUseOption> quickUseOptions, IObservableImageQueue imageQueue, IImageRepository imageRepository, IImageSourceConfigurations imageSourceConfigurations, IImageSaver saver, IImageSources imageSources, IWallpaperUpdater wallpaperUpdater, TestingSources testingSources) { _setup = setup; _logger = logger; _quickUseOptions = quickUseOptions; _imageQueue = imageQueue; _imageRepository = imageRepository; _imageSourceConfigurations = imageSourceConfigurations; _saver = saver; _imageSources = imageSources; _wallpaperUpdater = wallpaperUpdater; _testingSources = testingSources; }
public ImageSaverTests() { _imageSources = A.Fake <IImageSources>(); _imageFromSources = new[] { CreateImageFromSource("foo"), CreateImageFromSource("bar"), CreateImageFromSource("baz") }; _testScheduler = new TestScheduler(); _imagesFromSourcesObservable = _testScheduler.CreateHotObservable( _imageFromSources .Select( (image, i) => new Recorded <Notification <IImageFromSource> >(i + 2, // start events emitting after 2 ticks to allow for subscription Notification.CreateOnNext(image))) .ToArray()); A.CallTo(() => _imageSources.ImagesFromAllSources).Returns(_imagesFromSourcesObservable); _imageRepository = A.Fake <IImageRepository>(); _sut = new ImageSaver(_imageRepository, A.Fake <ILogger>()); }