Exemple #1
0
        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"));
        }
Exemple #2
0
        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"));
        }
Exemple #3
0
        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")));
        }
Exemple #4
0
        public void CanLoadFrom_WrongItemType_IsFalse()
        {
            var loader = new AniDbSeriesFromEmbyData(_aniDbClient, _sources);

            loader.CanLoadFrom(MediaItemTypes.Season).Should().BeFalse();
        }
Exemple #5
0
        public void CanLoadFrom_Null_IsFalse()
        {
            var loader = new AniDbSeriesFromEmbyData(_aniDbClient, _sources);

            loader.CanLoadFrom(null).Should().BeFalse();
        }
Exemple #6
0
        public void CanLoadFrom_CorrectItemType_IsTrue()
        {
            var loader = new AniDbSeriesFromEmbyData(_aniDbClient, _sources);

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