public async Task LoadFrom_NoMatchingSeries_Fails() { var loader = new AniDbSeriesFromEmbyData(_aniDbClient, _sources); var result = await loader.LoadFrom(_embyItemData); result.IsLeft.Should().BeTrue(); result.IfLeft(f => f.Reason.Should().Be("Failed to find series in AniDb")); }
public async Task LoadFrom_NoTitle_Fails() { _aniDbClient.FindSeriesAsync("Name").Returns(_aniDbSeriesData); _sources.AniDb.SelectTitle(_aniDbSeriesData.Titles, "en", Arg.Any <ProcessResultContext>()) .Returns(new ProcessFailedResult("", "", MediaItemTypes.Series, "FailedTitle")); var loader = new AniDbSeriesFromEmbyData(_aniDbClient, _sources); var result = await loader.LoadFrom(_embyItemData); result.IsLeft.Should().BeTrue(); result.IfLeft(f => f.Reason.Should().Be("FailedTitle")); }
public async Task LoadFrom_CreatesSourceData() { _aniDbClient.FindSeriesAsync("Name").Returns(_aniDbSeriesData); _sources.AniDb.SelectTitle(_aniDbSeriesData.Titles, "en", Arg.Any <ProcessResultContext>()) .Returns("Title"); var loader = new AniDbSeriesFromEmbyData(_aniDbClient, _sources); var result = await loader.LoadFrom(_embyItemData); result.IsRight.Should().BeTrue(); result.IfRight(sd => sd.Data.Should().Be(_aniDbSeriesData)); result.IfRight(sd => sd.Source.Should().Be(_sources.AniDb)); result.IfRight(sd => sd.Identifier.Should().BeEquivalentTo(new ItemIdentifier(67, Option <int> .None, "Title"))); }
public void CanLoadFrom_WrongItemType_IsFalse() { var loader = new AniDbSeriesFromEmbyData(_aniDbClient, _sources); loader.CanLoadFrom(MediaItemTypes.Season).Should().BeFalse(); }
public void CanLoadFrom_Null_IsFalse() { var loader = new AniDbSeriesFromEmbyData(_aniDbClient, _sources); loader.CanLoadFrom(null).Should().BeFalse(); }
public void CanLoadFrom_CorrectItemType_IsTrue() { var loader = new AniDbSeriesFromEmbyData(_aniDbClient, _sources); loader.CanLoadFrom(MediaItemTypes.Series).Should().BeTrue(); }