Exemplo n.º 1
0
        public MovieNfoParserTests()
        {
            _testUser = new User("Test User", "Auth provider", "Reset provider");

            var providerManager = new Mock <IProviderManager>();

            var tmdbExternalId = new TmdbMovieExternalId();
            var externalIdInfo = new ExternalIdInfo(tmdbExternalId.ProviderName, tmdbExternalId.Key, tmdbExternalId.Type, tmdbExternalId.UrlFormatString);

            providerManager.Setup(x => x.GetExternalIdInfos(It.IsAny <IHasProviderIds>()))
            .Returns(new[] { externalIdInfo });

            var nfoConfig = new XbmcMetadataOptions()
            {
                UserId = "F38E6443-090B-4F7A-BD12-9CFF5020F7BC"
            };
            var configManager = new Mock <IConfigurationManager>();

            configManager.Setup(x => x.GetConfiguration(It.IsAny <string>()))
            .Returns(nfoConfig);

            var user = new Mock <IUserManager>();

            user.Setup(x => x.GetUserById(It.IsAny <Guid>()))
            .Returns(_testUser);

            var userData = new Mock <IUserDataManager>();

            userData.Setup(x => x.GetUserData(_testUser, It.IsAny <BaseItem>()))
            .Returns(new UserItemData());

            _userDataManager = userData.Object;
            _parser          = new MovieNfoParser(new NullLogger <MovieNfoParser>(), configManager.Object, providerManager.Object, user.Object, userData.Object);
        }
Exemplo n.º 2
0
        public EpisodeNfoProviderTests()
        {
            var providerManager = new Mock <IProviderManager>();

            var imdbExternalId = new ImdbExternalId();
            var externalIdInfo = new ExternalIdInfo(imdbExternalId.ProviderName, imdbExternalId.Key, imdbExternalId.Type, imdbExternalId.UrlFormatString);

            providerManager.Setup(x => x.GetExternalIdInfos(It.IsAny <IHasProviderIds>()))
            .Returns(new[] { externalIdInfo });

            var config = new Mock <IConfigurationManager>();

            config.Setup(x => x.GetConfiguration(It.IsAny <string>()))
            .Returns(new XbmcMetadataOptions());
            var user             = new Mock <IUserManager>();
            var userData         = new Mock <IUserDataManager>();
            var directoryService = new Mock <IDirectoryService>();

            _parser = new EpisodeNfoParser(
                new NullLogger <EpisodeNfoParser>(),
                config.Object,
                providerManager.Object,
                user.Object,
                userData.Object,
                directoryService.Object);
        }
Exemplo n.º 3
0
        public MusicAlbumNfoProviderTests()
        {
            var providerManager = new Mock <IProviderManager>();

            var musicBrainzArtist = new MusicBrainzArtistExternalId();
            var externalIdInfo    = new ExternalIdInfo(musicBrainzArtist.ProviderName, musicBrainzArtist.Key, musicBrainzArtist.Type, "MusicBrainzServer");

            providerManager.Setup(x => x.GetExternalIdInfos(It.IsAny <IHasProviderIds>()))
            .Returns(new[] { externalIdInfo });

            var config = new Mock <IConfigurationManager>();

            config.Setup(x => x.GetConfiguration(It.IsAny <string>()))
            .Returns(new XbmcMetadataOptions());
            var user             = new Mock <IUserManager>();
            var userData         = new Mock <IUserDataManager>();
            var directoryService = new Mock <IDirectoryService>();

            _parser = new BaseNfoParser <MusicAlbum>(
                new NullLogger <BaseNfoParser <MusicAlbum> >(),
                config.Object,
                providerManager.Object,
                user.Object,
                userData.Object,
                directoryService.Object);
        }
Exemplo n.º 4
0
 public MetadataEditorInfo()
 {
     ParentalRatingOptions = new ParentalRating[] { };
     Countries             = new CountryInfo[] { };
     Cultures           = new CultureDto[] { };
     ExternalIdInfos    = new ExternalIdInfo[] { };
     ContentTypeOptions = Array.Empty <NameValuePair>();
 }
Exemplo n.º 5
0
        public MovieNfoParserTests()
        {
            _testUser = new User("Test User", "Auth provider", "Reset provider");

            var providerManager = new Mock <IProviderManager>();

            var tmdbExternalId = new TmdbMovieExternalId();
            var externalIdInfo = new ExternalIdInfo(tmdbExternalId.ProviderName, tmdbExternalId.Key, tmdbExternalId.Type, tmdbExternalId.UrlFormatString);

            providerManager.Setup(x => x.GetExternalIdInfos(It.IsAny <IHasProviderIds>()))
            .Returns(new[] { externalIdInfo });

            var nfoConfig = new XbmcMetadataOptions()
            {
                UserId = "F38E6443-090B-4F7A-BD12-9CFF5020F7BC"
            };
            var configManager = new Mock <IConfigurationManager>();

            configManager.Setup(x => x.GetConfiguration(It.IsAny <string>()))
            .Returns(nfoConfig);

            var user = new Mock <IUserManager>();

            user.Setup(x => x.GetUserById(It.IsAny <Guid>()))
            .Returns(_testUser);

            var userData = new Mock <IUserDataManager>();

            userData.Setup(x => x.GetUserData(_testUser, It.IsAny <BaseItem>()))
            .Returns(new UserItemData());

            var directoryService = new Mock <IDirectoryService>();

            _localImageFileMetadata = new FileSystemMetadata()
            {
                Exists   = true,
                FullName = OperatingSystem.IsWindows() ?
                           "C:\\media\\movies\\Justice League (2017).jpg"
                    : "/media/movies/Justice League (2017).jpg"
            };
            directoryService.Setup(x => x.GetFile(_localImageFileMetadata.FullName))
            .Returns(_localImageFileMetadata);

            _userDataManager = userData.Object;
            _parser          = new MovieNfoParser(
                new NullLogger <MovieNfoParser>(),
                configManager.Object,
                providerManager.Object,
                user.Object,
                userData.Object,
                directoryService.Object);
        }
Exemplo n.º 6
0
        private ExternalIdInfo convertExternalIdToExternalIdInfo(ExternalId externalId)
        {
            var result = new ExternalIdInfo
            {
                providerId  = externalId.providerId,
                externalId  = externalId.externalId,
                displayName = externalId.displayName,
                email       = externalId.email,
                phoneNumber = externalId.phoneNumber
            };

            return(result);
        }
Exemplo n.º 7
0
        public MovieNfoParserTests()
        {
            var providerManager = new Mock <IProviderManager>();

            var tmdbExternalId = new TmdbMovieExternalId();
            var externalIdInfo = new ExternalIdInfo(tmdbExternalId.ProviderName, tmdbExternalId.Key, tmdbExternalId.Type, tmdbExternalId.UrlFormatString);

            providerManager.Setup(x => x.GetExternalIdInfos(It.IsAny <IHasProviderIds>()))
            .Returns(new[] { externalIdInfo });

            var config = new Mock <IConfigurationManager>();

            config.Setup(x => x.GetConfiguration(It.IsAny <string>()))
            .Returns(new XbmcMetadataOptions());
            _parser = new MovieNfoParser(new NullLogger <MovieNfoParser>(), config.Object, providerManager.Object);
        }
Exemplo n.º 8
0
        private ExternalIdInfo[] convertExternalIdList(ExternalId[] externalIds)
        {
            if (externalIds == null)
            {
                return(new ExternalIdInfo[0]);
            }

            ExternalIdInfo[] externalIdInfos = new ExternalIdInfo[externalIds.Length];
            var index = 0;

            foreach (ExternalId id in externalIds)
            {
                var externalIdInfo = convertExternalIdToExternalIdInfo(id);
                externalIdInfos[index] = externalIdInfo;
                index++;
            }

            return(externalIdInfos);
        }