Ejemplo n.º 1
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"));
        }
Ejemplo n.º 2
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"));
        }
        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"));
        }
Ejemplo n.º 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")));
        }
Ejemplo n.º 6
0
        public void CanLoadFrom_WrongItemType_IsFalse()
        {
            var loader = new AniDbEpisodeFromEmbyData(this.sources, this.aniDbEpisodeMatcher, this.mappingList);

            loader.CanLoadFrom(MediaItemTypes.Season).Should().BeFalse();
        }
Ejemplo n.º 7
0
        public void CanLoadFrom_Null_IsFalse()
        {
            var loader = new AniDbEpisodeFromEmbyData(this.sources, this.aniDbEpisodeMatcher, this.mappingList);

            loader.CanLoadFrom(null).Should().BeFalse();
        }
Ejemplo n.º 8
0
        public void CanLoadFrom_CorrectItemType_IsTrue()
        {
            var loader = new AniDbEpisodeFromEmbyData(this.sources, this.aniDbEpisodeMatcher, this.mappingList);

            loader.CanLoadFrom(MediaItemTypes.Episode).Should().BeTrue();
        }
        public void CanLoadFrom_WrongItemType_IsFalse()
        {
            var loader = new AniDbEpisodeFromEmbyData(_sources, _aniDbEpisodeMatcher);

            loader.CanLoadFrom(MediaItemTypes.Season).Should().BeFalse();
        }
        public void CanLoadFrom_Null_IsFalse()
        {
            var loader = new AniDbEpisodeFromEmbyData(_sources, _aniDbEpisodeMatcher);

            loader.CanLoadFrom(null).Should().BeFalse();
        }
        public void CanLoadFrom_CorrectItemType_IsTrue()
        {
            var loader = new AniDbEpisodeFromEmbyData(_sources, _aniDbEpisodeMatcher);

            loader.CanLoadFrom(MediaItemTypes.Episode).Should().BeTrue();
        }