public TvShowImagesServiceTests() { _fileSystemService = Substitute.For<IFileSystemService>(); _path = @"C:\Folder\TV Shows\Game of Thrones"; _tvShowFileService = Substitute.For<ITvShowFileService>(); TvShowImages images = new TvShowImages { Fanart = @"C:\Folder\TV Shows\Game of Thrones\fanart.jpg", Poster = @"C:\Folder\TV Shows\Game of Thrones\poster.jpg", Banner = @"C:\Folder\TV Shows\Game of Thrones\banner.jpg", Seasons = new List<Season> { new Season { SeasonNumber = 0, Path = @"C:\Folder\TV Shows\Game of Thrones\Specials", PosterUrl = @"C:\Folder\TV Shows\Game of Thrones\season-specials-poster.jpg", BannerUrl = @"C:\Folder\TV Shows\Game of Thrones\season-specials-banner.jpg" }, new Season { SeasonNumber = 1, Path = @"C:\Folder\TV Shows\Game of Thrones\Season 1", PosterUrl = @"C:\Folder\TV Shows\Game of Thrones\season01-poster.jpg", BannerUrl = @"C:\Folder\TV Shows\Game of Thrones\season01-banner.jpg" } } }; _tvShowFileService.GetShowImages(_path) .Returns(images.ToTask()); _service = new TvShowImagesService(_fileSystemService, _tvShowFileService); }
public TvShowImagesServiceTests() { _fileSystemService = Substitute.For <IFileSystemService>(); _path = @"C:\Folder\TV Shows\Game of Thrones"; _tvShowFileService = Substitute.For <ITvShowFileService>(); TvShowImages images = new TvShowImages { Fanart = @"C:\Folder\TV Shows\Game of Thrones\fanart.jpg", Poster = @"C:\Folder\TV Shows\Game of Thrones\poster.jpg", Banner = @"C:\Folder\TV Shows\Game of Thrones\banner.jpg", Seasons = new List <Season> { new Season { SeasonNumber = 0, Path = @"C:\Folder\TV Shows\Game of Thrones\Specials", PosterUrl = @"C:\Folder\TV Shows\Game of Thrones\season-specials-poster.jpg", BannerUrl = @"C:\Folder\TV Shows\Game of Thrones\season-specials-banner.jpg" }, new Season { SeasonNumber = 1, Path = @"C:\Folder\TV Shows\Game of Thrones\Season 1", PosterUrl = @"C:\Folder\TV Shows\Game of Thrones\season01-poster.jpg", BannerUrl = @"C:\Folder\TV Shows\Game of Thrones\season01-banner.jpg" } } }; _tvShowFileService.GetShowImages(_path) .Returns(images.ToTask()); _service = new TvShowImagesService(_fileSystemService, _tvShowFileService); }
public async Task Update(string path, AvailableTvShowImages images) { TvShowImages tvShowImages = await _tvShowFileService.GetShowImages(path); await UpdateImageIfNeeded(tvShowImages.Fanart, images.Fanarts); await UpdateImageIfNeeded(tvShowImages.Poster, images.Posters); await UpdateImageIfNeeded(tvShowImages.Banner, images.Banners); await UpdateSeasonImages(tvShowImages.Seasons, images.Seasons); }
public async Task Delete(string path) { TvShowImages tvShowImages = await _tvShowFileService.GetShowImages(path); await _fileSystemService.DeleteFile(tvShowImages.Fanart); await _fileSystemService.DeleteFile(tvShowImages.Poster); await _fileSystemService.DeleteFile(tvShowImages.Banner); await DeleteSeasonImages(tvShowImages.Seasons); }