Пример #1
0
        public async Task LoadFrom_NoAniDbSeriesId_Fails()
        {
            SetUpTvDbSeriesData(53);

            var loader = new AniDbEpisodeFromTvDb(_sources, _mappingList, _episodeMapper);

            var result = await loader.LoadFrom(_mediaItem, _tvDbSourceData);

            result.IsLeft.Should().BeTrue();
            result.IfLeft(f => f.Reason.Should().Be("Failed to find AniDb series Id"));
        }
Пример #2
0
        public async Task LoadFrom_NoSeriesMapping_Fails()
        {
            SetUpTvDbSeriesData(53);
            _embyData.GetParentId(MediaItemTypes.Series, _sources.AniDb).Returns(19);

            var loader = new AniDbEpisodeFromTvDb(_sources, _mappingList, _episodeMapper);

            var result = await loader.LoadFrom(_mediaItem, _tvDbSourceData);

            result.IsLeft.Should().BeTrue();
            result.IfLeft(f => f.Should().Be(_noMappingResult));
        }
Пример #3
0
        public async Task LoadFrom_NoTvDbSeriesData_Fails()
        {
            _sources.TvDb.GetSeriesData(_embyData, Arg.Any <ProcessResultContext>())
            .Returns(new ProcessFailedResult("", "", MediaItemTypes.Episode, "Failed"));

            var loader = new AniDbEpisodeFromTvDb(_sources, _mappingList, _episodeMapper);

            var result = await loader.LoadFrom(_mediaItem, _tvDbSourceData);

            result.IsLeft.Should().BeTrue();
            result.IfLeft(f => f.Reason.Should().Be("Failed"));
        }
Пример #4
0
        public async Task LoadFrom_NoCorrespondingAniDbEpisode_Fails()
        {
            SetUpTvDbSeriesData(53);
            _embyData.GetParentId(MediaItemTypes.Series, _sources.AniDb).Returns(19);

            var seriesMapping = CreateSeriesMapping(53, 19);

            _mappingList.GetSeriesMappingsFromTvDb(53, Arg.Any <ProcessResultContext>()).Returns(new[]
            {
                seriesMapping
            });

            var loader = new AniDbEpisodeFromTvDb(_sources, _mappingList, _episodeMapper);

            var result = await loader.LoadFrom(_mediaItem, _tvDbSourceData);

            result.IsLeft.Should().BeTrue();
            result.IfLeft(f => f.Reason.Should().Be("Failed to find a corresponding AniDb episode in AniDb series id '19'"));
        }
Пример #5
0
        public async Task LoadFrom_NoMatchingSeriesMappings_Fails()
        {
            SetUpTvDbSeriesData(53);
            _embyData.GetParentId(MediaItemTypes.Series, _sources.AniDb).Returns(19);

            var seriesMappings = new[]
            {
                CreateSeriesMapping(53, 55)
            };

            _mappingList.GetSeriesMappingsFromTvDb(53, Arg.Any <ProcessResultContext>()).Returns(seriesMappings);

            var loader = new AniDbEpisodeFromTvDb(_sources, _mappingList, _episodeMapper);

            var result = await loader.LoadFrom(_mediaItem, _tvDbSourceData);

            result.IsLeft.Should().BeTrue();
            result.IfLeft(f => f.Reason.Should().Be("No series mapping between TvDb series Id '53' and AniDb series id '19'"));
        }
Пример #6
0
        public async Task LoadFrom_MultipleSeriesMappings_Fails()
        {
            this.SetUpTvDbSeriesData(53);
            this.embyData.GetParentId(MediaItemTypes.Series, this.sources.AniDb).Returns(19);

            var seriesMappings = new[]
            {
                this.CreateSeriesMapping(53, 19),
                this.CreateSeriesMapping(53, 19)
            };

            this.mappingList.GetSeriesMappingsFromTvDb(53, Arg.Any <ProcessResultContext>()).Returns(seriesMappings);

            var loader = new AniDbEpisodeFromTvDb(this.sources, this.mappingList, this.episodeMapper);

            var result = await loader.LoadFrom(this.mediaItem, this.tvDbSourceData);

            result.IsLeft.Should().BeTrue();
            result.IfLeft(f => f.Reason.Should().Be("Multiple series mappings found between TvDb series Id '53' and AniDb series Id '19'"));
        }
Пример #7
0
        public async Task LoadFrom_ReturnsSourceDataWithSelectedTitle()
        {
            SetUpTvDbSeriesData(53);
            _embyData.GetParentId(MediaItemTypes.Series, _sources.AniDb).Returns(19);

            var seriesMapping = CreateSeriesMapping(53, 19);

            _mappingList.GetSeriesMappingsFromTvDb(53, Arg.Any <ProcessResultContext>()).Returns(new[]
            {
                seriesMapping
            });

            var aniDbEpisodeData = SetUpEpisodeMapping(67, 92, seriesMapping, "Title");

            var loader = new AniDbEpisodeFromTvDb(_sources, _mappingList, _episodeMapper);

            var result = await loader.LoadFrom(_mediaItem, _tvDbSourceData);

            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(92, 1, "Title")));
        }
Пример #8
0
        public async Task LoadFrom_NoSelectableTitle_Fails()
        {
            SetUpTvDbSeriesData(53);
            _embyData.GetParentId(MediaItemTypes.Series, _sources.AniDb).Returns(19);

            var seriesMapping = CreateSeriesMapping(53, 19);

            _mappingList.GetSeriesMappingsFromTvDb(53, Arg.Any <ProcessResultContext>()).Returns(new[]
            {
                seriesMapping
            });

            var aniDbEpisodeData = SetUpEpisodeMapping(67, 92, seriesMapping, "");

            _sources.AniDb.SelectTitle(aniDbEpisodeData.Titles, "en", Arg.Any <ProcessResultContext>())
            .Returns(new ProcessFailedResult("", "", MediaItemTypes.Episode, "Failed to find a title"));

            var loader = new AniDbEpisodeFromTvDb(_sources, _mappingList, _episodeMapper);

            var result = await loader.LoadFrom(_mediaItem, _tvDbSourceData);

            result.IsLeft.Should().BeTrue();
            result.IfLeft(f => f.Reason.Should().Be("Failed to find a title"));
        }