public void DoesNotModifyInstanceCalledOn()
            {
                var mediaItem = new MediaItem(Substitute.For <IEmbyItemData>(), MediaItemTypes.Series, SourceData);

                mediaItem.AddData(SourceData2);

                mediaItem.GetDataFromSource(Source).ValueUnsafe().Should().Be(SourceData);
                mediaItem.GetDataFromSource(Source2).IsNone.Should().BeTrue();
            }
Exemple #2
0
        public void Setup()
        {
            PropertyMappings = Substitute.For <IPropertyMappingCollection>();
            PropertyMappings.Apply(Arg.Any <IEnumerable <object> >(), Arg.Any <MetadataResult <Series> >(),
                                   Arg.Any <Action <string> >())
            .Returns(x => x.Arg <MetadataResult <Series> >());
            PropertyMappings.GetEnumerator()
            .Returns(new IPropertyMapping[]
            {
                new PropertyMapping <AniDbSeriesData, MetadataResult <Series>, string>("Name", s => s.Item.Name,
                                                                                       (s, t) => t.Item.Name = "Name", SourceNames.AniDb)
            }.AsEnumerable().GetEnumerator());

            PluginConfiguration = Substitute.For <IPluginConfiguration>();

            var embyItemData = Substitute.For <IEmbyItemData>();

            embyItemData.Language.Returns("en");

            _sources = new TestSources();
            var aniDbSourceData = new SourceData <AniDbSeriesData>(_sources.AniDb, 33, new ItemIdentifier(33, 1, "Name"),
                                                                   new AniDbSeriesData());

            MediaItem = Substitute.For <IMediaItem>();
            MediaItem.GetAllSourceData().Returns(new ISourceData[] { aniDbSourceData });
            MediaItem.GetDataFromSource(null).ReturnsForAnyArgs(aniDbSourceData);
            MediaItem.EmbyData.Returns(embyItemData);

            MediaItemType = new MediaItemType <Series>("Series", (c, l) => PropertyMappings);
        }
Exemple #3
0
            public void NoLibrarySourceData_ReturnsFailure()
            {
                MediaItem.GetAllSourceData().Returns(new ISourceData[] { });
                MediaItem.GetDataFromSource(null).ReturnsForAnyArgs(Option <ISourceData> .None);

                var result = MediaItemType.CreateMetadataFoundResult(PluginConfiguration, MediaItem, new ConsoleLogManager());

                result.IsLeft.Should().BeTrue();
                result.IfLeft(r => r.Reason.Should().Be("No data returned by library structure source"));
            }
            public void AddsInitialData()
            {
                var mediaItem = new MediaItem(Substitute.For <IEmbyItemData>(), MediaItemTypes.Series, SourceData);

                mediaItem.GetDataFromSource(Source).ValueUnsafe().Should().Be(SourceData);
            }
            public void NoDataWithMatchingSource_ReturnsNone()
            {
                var mediaItem = new MediaItem(Substitute.For <IEmbyItemData>(), MediaItemTypes.Series, SourceData);

                mediaItem.GetDataFromSource(Source2).IsNone.Should().BeTrue();
            }