Exemplo n.º 1
0
        public async Task MultipleUsers()
        {
            _mocker.Setup <ISettingsService <PlexSettings>, Task <PlexSettings> >(x => x.GetSettingsAsync()).ReturnsAsync(new PlexSettings {
                Enable = true, EnableWatchlistImport = true
            });
            var um = MockHelper.MockUserManager(new List <OmbiUser>
            {
                new OmbiUser {
                    Id = "abc1", UserType = UserType.PlexUser, MediaServerToken = "abc1", UserName = "******", NormalizedUserName = "******"
                },
                new OmbiUser {
                    Id = "abc2", UserType = UserType.PlexUser, MediaServerToken = "abc2", UserName = "******", NormalizedUserName = "******"
                },
                new OmbiUser {
                    Id = "abc3", UserType = UserType.PlexUser, MediaServerToken = "abc3", UserName = "******", NormalizedUserName = "******"
                },
                new OmbiUser {
                    Id = "abc4", UserType = UserType.PlexUser, MediaServerToken = "abc4", UserName = "******", NormalizedUserName = "******"
                },
                new OmbiUser {
                    Id = "abc5", UserType = UserType.PlexUser, MediaServerToken = "abc5", UserName = "******", NormalizedUserName = "******"
                },
            });

            _mocker.Use(um);
            _subject = _mocker.CreateInstance <PlexWatchlistImport>();

            await _subject.Execute(_context.Object);

            _mocker.Verify <IPlexApi>(x => x.GetWatchlist(It.IsAny <string>(), It.IsAny <CancellationToken>()), Times.Exactly(5));
            _mocker.Verify <IMovieRequestEngine>(x => x.RequestMovie(It.IsAny <MovieRequestViewModel>()), Times.Never);
            _mocker.Verify <IExternalRepository <PlexWatchlistHistory> >(x => x.GetAll(), Times.Never);
            _mocker.Verify <IExternalRepository <PlexWatchlistHistory> >(x => x.Add(It.IsAny <PlexWatchlistHistory>()), Times.Never);
        }
Exemplo n.º 2
0
        public void Setup()
        {
            _mocker = new AutoMocker();
            var um = MockHelper.MockUserManager(new List <OmbiUser> {
                new OmbiUser {
                    Id = "abc", UserType = UserType.PlexUser, MediaServerToken = "abc", UserName = "******", NormalizedUserName = "******"
                }
            });

            _mocker.Use(um);
            _context = _mocker.GetMock <IJobExecutionContext>();
            _context.Setup(x => x.CancellationToken).Returns(CancellationToken.None);
            _subject = _mocker.CreateInstance <PlexWatchlistImport>();
        }