Ejemplo n.º 1
0
        public async Task LoadFrom_NoSeriesMapping_Fails()
        {
            this.CreateAniDbSeries(342, "SeriesName");

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

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

            result.IsLeft.Should().BeTrue();
            result.IfLeft(f => f.Should().Be(this.noMappingResult));
        }
Ejemplo n.º 2
0
        public async Task LoadFrom_NoTvDbIdOnMapping_Fails()
        {
            this.CreateAniDbSeries(342, "SeriesName");
            this.SetUpSeriesMapping(342, null);

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

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

            result.IsLeft.Should().BeTrue();
            result.IfLeft(f => f.Reason.Should().Be("No TvDb Id found on matching mapping"));
        }
Ejemplo n.º 3
0
        public async Task LoadFrom_NoAniDbIdOnSourceData_Fails()
        {
            this.aniDbSourceData.Id.Returns(Option <int> .None);

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

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

            result.IsLeft.Should().BeTrue();
            result.IfLeft(f =>
                          f.Reason.Should().Be("No AniDb Id found on the AniDb data associated with this media item"));
        }
Ejemplo n.º 4
0
        public async Task LoadFrom_FailsToLoadTvDbSeries_Fails()
        {
            this.CreateAniDbSeries(342, "SeriesName");
            this.SetUpSeriesMapping(342, 66);

            this.sources.TvDb.GetSeriesData(66, Arg.Any <ProcessResultContext>())
            .Returns(new ProcessFailedResult(string.Empty, string.Empty, MediaItemTypes.Series, "Failed"));

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

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

            result.IsLeft.Should().BeTrue();
            result.IfLeft(f => f.Reason.Should().Be("Failed"));
        }
Ejemplo n.º 5
0
        public async Task LoadFrom_MapsToTvDbSeries()
        {
            this.CreateAniDbSeries(342, "SeriesName");
            this.SetUpSeriesMapping(342, 66);

            var tvDbSeriesData = TvDbTestData.Series(66);

            this.sources.TvDb.GetSeriesData(66, Arg.Any <ProcessResultContext>())
            .Returns(tvDbSeriesData);

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

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

            result.IsRight.Should().BeTrue();
            result.IfRight(sd => sd.Data.Should().Be(tvDbSeriesData));
            result.IfRight(sd => sd.Source.Should().Be(this.sources.TvDb));
            result.IfRight(sd => sd.Id.ValueUnsafe().Should().Be(66));
            result.IfRight(sd => sd.Identifier.Should().BeEquivalentTo(new ItemIdentifier(Option <int> .None, Option <int> .None, string.Empty)));
        }