예제 #1
0
        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);
            };
        }
예제 #2
0
        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);
        }
예제 #3
0
 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;
 }
예제 #4
0
 public ImageSources(IImageSourceConfigurations configurations, IImageSourceFactory imageSourceFactory)
 {
     _configurations     = configurations;
     _imageSourceFactory = imageSourceFactory;
 }