public void TestFanArtExtractSeasonActorFolderFanArt() { //Arrange _fanArtCache.Clear(); Guid seasonId = Guid.NewGuid(); Guid actor1Id = Guid.NewGuid(); Guid actor2Id = Guid.NewGuid(); IList <Tuple <Guid, string> > actors = new List <Tuple <Guid, string> > { new Tuple <Guid, string>(actor1Id, "Season Actor1"), new Tuple <Guid, string>(actor2Id, "Season Actor2") }; SeriesFanArtHandlerForTests fh = new SeriesFanArtHandlerForTests(); //Act fh.TestExtractSeasonFolderFanArt(seasonId, ResourcePath.BuildBaseProviderPath(MockResourceProvider.PROVIDER_ID, "Series/TestSeries/Season 1/episode1.mkv"), 1, actors).Wait(); //Assert List <string> fanart; Assert.IsTrue(_fanArtCache.FanArt.TryGetValue(actor1Id, out fanart)); ICollection <string> fanartBasePaths = fanart.Select(p => ResourcePath.Deserialize(p).BasePathSegment.Path).ToList(); CollectionAssert.Contains(fanartBasePaths, "Series/TestSeries/Season 1/.actors/season_actor1-thumb.png"); Assert.IsTrue(_fanArtCache.FanArt.TryGetValue(actor2Id, out fanart)); fanartBasePaths = fanart.Select(p => ResourcePath.Deserialize(p).BasePathSegment.Path).ToList(); CollectionAssert.Contains(fanartBasePaths, "Series/TestSeries/Season 1/.actors/season_actor2-thumb.png"); }
public void TestFanArtGetAdditionalSeasonFolderFanArt(string[] paths, int seasonNumber, int expectedCount) { //Arrange List <ResourcePath> resourcePaths = paths.Select(p => ResourcePath.BuildBaseProviderPath(MockResourceProvider.PROVIDER_ID, p)).ToList(); SeriesFanArtHandlerForTests fh = new SeriesFanArtHandlerForTests(); //Act FanArtPathCollection fanart = fh.TestGetAdditionalSeasonFolderFanArt(resourcePaths, seasonNumber); //Assert Assert.AreEqual(expectedCount, fanart.Sum(kvp => kvp.Value.Count)); }
public void TestFanArtExtractEpisodeFolderFanArt() { //Arrange _fanArtCache.Clear(); Guid episodeId = Guid.NewGuid(); SeriesFanArtHandlerForTests fh = new SeriesFanArtHandlerForTests(); //Act fh.TestExtractEpisodeFolderFanArt(episodeId, ResourcePath.BuildBaseProviderPath(MockResourceProvider.PROVIDER_ID, "Series/TestSeries/Season 1/episode1.mkv")).Wait(); //Assert List <string> fanart; Assert.IsTrue(_fanArtCache.FanArt.TryGetValue(episodeId, out fanart)); ICollection <string> fanartBasePaths = fanart.Select(p => ResourcePath.Deserialize(p).BasePathSegment.Path).ToList(); CollectionAssert.Contains(fanartBasePaths, "Series/TestSeries/Season 1/episode1-thumb.png"); }