public SourcesModule(IImageSourceConfigurations sourceConfigurations, IImageSourceConfigurationFactory sourceConfigurationFactory) : base("/sources") { Get["/"] = _ => sourceConfigurations.Select(s => new ImageSourceViewModel(s.ImageSourceId.Value, s.SourceType.Value)); Post["/add", true] = async(parameters, ctx) => { var request = this.Bind <AddRequestModel>(); IImageSourceConfiguration source = sourceConfigurationFactory.CreateNewSource(new ImageSourceType(request.SourceType)); await sourceConfigurations.Add(source); return(source.ImageSourceId); }; }
public WallrApplicationTests() { _setup = A.Fake <ISetup>(); _quickUseOptions = new[] { A.Fake <IQuickUseOption>(), A.Fake <IQuickUseOption>(), A.Fake <IQuickUseOption>() }; _imageQueue = A.Fake <IObservableImageQueue>(); _imageRepository = A.Fake <IImageRepository>(); _imageSourceConfigurations = A.Fake <IImageSourceConfigurations>(); var imageSaver = A.Fake <IImageSaver>(); var imageSources = A.Fake <IImageSources>(); _savedImages = A.Fake <IObservable <ISavedImage> >(); A.CallTo(() => imageSaver.StartSavingImages(imageSources)).Returns(_savedImages); _wallpaperUpdater = A.Fake <IWallpaperUpdater>(); var testingSources = A.Fake <TestingSources>(); _wallrApplication = new WallrApplication(_setup, A.Fake <ILogger>(), _quickUseOptions, _imageQueue, _imageRepository, _imageSourceConfigurations, imageSaver, imageSources, _wallpaperUpdater, testingSources); }
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 ImageSources(IImageSourceConfigurations configurations, IImageSourceFactory imageSourceFactory) { _configurations = configurations; _imageSourceFactory = imageSourceFactory; }