Пример #1
0
        public async Task LoadFrom_NoSeriesData_Fails()
        {
            this.sources.AniDb.GetSeriesData(this.mediaItem.EmbyData, Arg.Any <ProcessResultContext>())
            .Returns(new ProcessFailedResult(string.Empty, string.Empty, MediaItemTypes.Episode, "FailedSeriesData"));

            var loader = new AniDbEpisodeFromEmbyData(this.sources, this.aniDbEpisodeMatcher, this.mappingList);

            var result = await loader.LoadFrom(this.embyItemData);

            result.IsLeft.Should().BeTrue();
            result.IfLeft(f => f.Reason.Should().Be("FailedSeriesData"));
        }
Пример #2
0
        public async Task LoadFrom_NoFoundEpisode_Fails()
        {
            this.sources.AniDb.GetSeriesData(this.mediaItem.EmbyData, Arg.Any <ProcessResultContext>())
            .Returns(this.aniDbSeriesData);

            var loader = new AniDbEpisodeFromEmbyData(this.sources, this.aniDbEpisodeMatcher, this.mappingList);

            var result = await loader.LoadFrom(this.embyItemData);

            result.IsLeft.Should().BeTrue();
            result.IfLeft(f => f.Reason.Should().Be("Failed to find episode in AniDb"));
        }
        public async Task LoadFrom_NoSeriesData_Fails()
        {
            _sources.AniDb.GetSeriesData(_mediaItem.EmbyData, Arg.Any <ProcessResultContext>())
            .Returns(new ProcessFailedResult("", "", MediaItemTypes.Episode, "FailedSeriesData"));

            var loader = new AniDbEpisodeFromEmbyData(_sources, _aniDbEpisodeMatcher);

            var result = await loader.LoadFrom(_embyItemData);

            result.IsLeft.Should().BeTrue();
            result.IfLeft(f => f.Reason.Should().Be("FailedSeriesData"));
        }
        public async Task LoadFrom_NoTitle_Fails()
        {
            _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(new ProcessFailedResult("", "", MediaItemTypes.Episode, "FailedTitle"));

            var loader = new AniDbEpisodeFromEmbyData(_sources, _aniDbEpisodeMatcher);

            var result = await loader.LoadFrom(_embyItemData);

            result.IsLeft.Should().BeTrue();
            result.IfLeft(f => f.Reason.Should().Be("FailedTitle"));
        }
Пример #5
0
        public async Task LoadFrom_CreatesSourceData()
        {
            this.sources.AniDb.GetSeriesData(this.mediaItem.EmbyData, Arg.Any <ProcessResultContext>())
            .Returns(this.aniDbSeriesData);

            this.aniDbEpisodeMatcher.FindEpisode(this.aniDbSeriesData.Episodes, 1, 67, "Name")
            .Returns(this.aniDbEpisodeData);

            this.sources.AniDb.SelectTitle(this.aniDbEpisodeData.Titles, "en", Arg.Any <ProcessResultContext>())
            .Returns("Title");

            var loader = new AniDbEpisodeFromEmbyData(this.sources, this.aniDbEpisodeMatcher, this.mappingList);

            var result = await loader.LoadFrom(this.embyItemData);

            result.IsRight.Should().BeTrue();
            result.IfRight(sd => sd.Data.Should().Be(this.aniDbEpisodeData));
            result.IfRight(sd => sd.Source.Should().Be(this.sources.AniDb));
            result.IfRight(sd => sd.Identifier.Should().BeEquivalentTo(new ItemIdentifier(67, 1, "Title")));
        }