public CommonParameters(IEventAggregator eventAgg, IOfflineServiceProvider offline, IOnlineServiceProvider online, SnackbarMessageQueue statusMessage, ImageCacher imageCacher) { EventAggregator = eventAgg; OfflineService = offline; OnlineService = online; StatusMessage = statusMessage; ImageCacher = imageCacher; }
private static CommonParameters InitializeCommonParameters(AppFolders appFolders) { _database = new Db(appFolders.AppRootFolder); var eventAgg = new EventAggregator(); var imageCacher = new ImageCacher( appFolders.ImageCacheFolder, new WebClient(), "https://image.tmdb.org/t/p/w500"); return(_commonParameters = new CommonParameters( eventAgg, new OfflineServiceProvider(_database), new OnlineServiceProvider(eventAgg), new SnackbarMessageQueue(), imageCacher)); }
public async Task CacheAsync(string subfolder) { // prepare var fileName = Guid.NewGuid().ToString() + ".dat"; var cacher = new ImageCacher(); // act var result = await cacher.CacheAsync(subfolder + fileName, GetSomeData); // verify Assert.EndsWith(fileName, result); Assert.True(File.Exists(result)); using (var file = File.OpenRead(result)) using (var someData = GetSomeData()) Assert.Equal(await GetContentAsync(someData), await GetContentAsync(file)); }