private Either <ProcessFailedResult, AniDbEpisodeData> GetAniDbEpisodeData(AniDbSeriesData aniDbSeriesData, IEmbyItemData embyItemData, ProcessResultContext resultContext) { return(_aniDbEpisodeMatcher.FindEpisode(aniDbSeriesData.Episodes, embyItemData.Identifier.ParentIndex, embyItemData.Identifier.Index, embyItemData.Identifier.Name) .ToEither(resultContext.Failed("Failed to find episode in AniDb"))); }
public async Task LoadFrom_CreatesSourceData() { _sources.AniDb.GetSeriesData(_mediaItem.EmbyData, Arg.Any <ProcessResultContext>()) .Returns(_aniDbSeriesData); _aniDbEpisodeMatcher.FindEpisode(_aniDbSeriesData.Episodes, 1, 67, "Name") .Returns(_aniDbEpisodeData); _sources.AniDb.SelectTitle(_aniDbEpisodeData.Titles, "en", Arg.Any <ProcessResultContext>()) .Returns("Title"); var loader = new AniDbEpisodeFromEmbyData(_sources, _aniDbEpisodeMatcher); var result = await loader.LoadFrom(_embyItemData); result.IsRight.Should().BeTrue(); result.IfRight(sd => sd.Data.Should().Be(_aniDbEpisodeData)); result.IfRight(sd => sd.Source.Should().Be(_sources.AniDb)); result.IfRight(sd => sd.Identifier.Should().BeEquivalentTo(new ItemIdentifier(67, 1, "Title"))); }