当前位置: 首页>>代码示例>>C#>>正文


C# Notification.ProgressNotification类代码示例

本文整理汇总了C#中NzbDrone.Core.Model.Notification.ProgressNotification的典型用法代码示例。如果您正苦于以下问题:C# ProgressNotification类的具体用法?C# ProgressNotification怎么用?C# ProgressNotification使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ProgressNotification类属于NzbDrone.Core.Model.Notification命名空间,在下文中一共展示了ProgressNotification类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SeasonSearch_partial_season_success

        public void SeasonSearch_partial_season_success()
        {
            var episodes = Builder<Episode>.CreateListOfSize(5)
                .All()
                .With(e => e.SeriesId = 1)
                .With(e => e.SeasonNumber = 1)
                .Build();

            var notification = new ProgressNotification("Season Search");

            Mocker.GetMock<SearchProvider>()
                .Setup(c => c.SeasonSearch(notification, 1, 1)).Returns(false);

            Mocker.GetMock<EpisodeProvider>()
                .Setup(c => c.GetEpisodesBySeason(1, 1)).Returns(episodes);

            Mocker.GetMock<SearchProvider>()
                .Setup(c => c.PartialSeasonSearch(notification, 1, 1))
                .Returns(episodes.Select(e => e.EpisodeNumber).ToList());

            //Act
            Mocker.Resolve<SeasonSearchJob>().Start(notification, 1, 1);

            //Assert
            Mocker.VerifyAllMocks();
            Mocker.GetMock<SearchProvider>().Verify(c => c.SeasonSearch(notification, 1, 1), Times.Once());
            Mocker.GetMock<SearchProvider>().Verify(c => c.PartialSeasonSearch(notification, 1, 1), Times.Once());
            Mocker.GetMock<EpisodeSearchJob>().Verify(c => c.Start(notification, It.IsAny<int>(), 0), Times.Never());
        }
开发者ID:ShironDrake,项目名称:NzbDrone,代码行数:29,代码来源:SeasonSearchJobTest.cs

示例2: BannerDownload_some_null_BannerUrl

        public void BannerDownload_some_null_BannerUrl()
        {
            //Setup
            var fakeSeries = Builder<Series>.CreateListOfSize(10)
                .Random(2)
                .With(s => s.BannerUrl = null)
                .Build();

          var notification = new ProgressNotification("Banner Download");

            Mocker.GetMock<SeriesProvider>()
                .Setup(c => c.GetAllSeries())
                .Returns(fakeSeries);

            Mocker.GetMock<HttpProvider>()
                .Setup(s => s.DownloadFile(It.IsAny<string>(), It.IsAny<string>()));

            Mocker.GetMock<DiskProvider>()
                .Setup(S => S.CreateDirectory(It.IsAny<string>()))
                .Returns("");

            //Act
            Mocker.Resolve<BannerDownloadJob>().Start(notification, 0, 0);

            //Assert
            Mocker.VerifyAllMocks();
            Mocker.GetMock<HttpProvider>().Verify(s => s.DownloadFile(It.IsAny<string>(), It.IsAny<string>()),
                                                       Times.Exactly(8));
        }
开发者ID:ShironDrake,项目名称:NzbDrone,代码行数:29,代码来源:BannerDownloadJobTest.cs

示例3: SeasonSearch_partial_season_failure

        public void SeasonSearch_partial_season_failure()
        {
            var episodes = Builder<Episode>.CreateListOfSize(5)
                .All()
                .With(e => e.SeriesId = 1)
                .With(e => e.SeasonNumber = 1)
                .With(e => e.Ignored = false)
                .With(e => e.AirDate = DateTime.Today.AddDays(-1))
                .Build();

            var notification = new ProgressNotification("Season Search");

            Mocker.GetMock<SearchProvider>()
                .Setup(c => c.SeasonSearch(notification, 1, 1)).Returns(false);

            Mocker.GetMock<EpisodeProvider>()
                .Setup(c => c.GetEpisodesBySeason(1, 1)).Returns(episodes);

            Mocker.GetMock<SearchProvider>()
                .Setup(c => c.PartialSeasonSearch(notification, 1, 1))
                .Returns(new List<int>{1});

            //Act
            Mocker.Resolve<SeasonSearchJob>().Start(notification, 1, 1);

            //Assert
            Mocker.VerifyAllMocks();
            Mocker.GetMock<SearchProvider>().Verify(c => c.SeasonSearch(notification, 1, 1), Times.Once());
            Mocker.GetMock<SearchProvider>().Verify(c => c.PartialSeasonSearch(notification, 1, 1), Times.Once());
        }
开发者ID:ShironDrake,项目名称:NzbDrone,代码行数:30,代码来源:SeasonSearchJobTest.cs

示例4: Start

        public virtual void Start(ProgressNotification notification, dynamic options)
        {
            if (options == null || options.EpisodeId <= 0)
                throw new ArgumentException("options");

            _searchProvider.EpisodeSearch(notification, options.EpisodeId);
        }
开发者ID:Normmatt,项目名称:NzbDrone,代码行数:7,代码来源:EpisodeSearchJob.cs

示例5: individual_missing_episode

        public void individual_missing_episode()
        {
            //Setup
            var notification = new ProgressNotification("Backlog Search Job Test");

            var series = Builder<Series>.CreateNew()
                    .With(s => s.Monitored = true)
                    .With(s => s.BacklogSetting = BacklogSettingType.Enable)
                    .Build();

            var episodes = Builder<Episode>.CreateListOfSize(1)
                .All()
                .With(e => e.Series = series)
                .Build();

            WithStrictMocker();
            WithEnableBacklogSearching();

            Mocker.GetMock<EpisodeProvider>()
                .Setup(s => s.EpisodesWithoutFiles(true)).Returns(episodes);

            Mocker.GetMock<EpisodeSearchJob>()
                .Setup(s => s.Start(notification, It.IsAny<int>(), 0)).Verifiable();

            //Act
            Mocker.Resolve<BacklogSearchJob>().Start(notification, 0, 0);

            //Assert
            Mocker.GetMock<SeasonSearchJob>().Verify(c => c.Start(notification, It.IsAny<int>(), It.IsAny<int>()),
                                                       Times.Never());

            Mocker.GetMock<EpisodeSearchJob>().Verify(c => c.Start(notification, It.IsAny<int>(), 0),
                                                       Times.Once());
        }
开发者ID:ShironDrake,项目名称:NzbDrone,代码行数:34,代码来源:BacklogSearchJobTest.cs

示例6: FinalizeSearch

        protected override void FinalizeSearch(Series series, dynamic options, Boolean reportsFound, ProgressNotification notification)
        {
            logger.Warn("Unable to find {0} in any of indexers.", options.Episode);

            notification.CurrentMessage = reportsFound ? String.Format("Sorry, couldn't find {0}, that matches your preferences.", options.Episode.AirDate)
                                                        : String.Format("Sorry, couldn't find {0} in any of indexers.", options.Episode);
        }
开发者ID:realpatriot,项目名称:NzbDrone,代码行数:7,代码来源:DailyEpisodeSearch.cs

示例7: Start

        public virtual void Start(ProgressNotification notification, dynamic options)
        {
            IList<Series> seriesToUpdate;
            if (options == null || options.SeriesId == 0)
            {
                seriesToUpdate = _seriesProvider.GetAllSeries().OrderBy(o => SortHelper.SkipArticles(o.Title)).ToList();
            }
            else
            {
                seriesToUpdate = new List<Series> { _seriesProvider.GetSeries(options.SeriesId) };
            }

            //Update any Daily Series in the DB with the IsDaily flag
            _referenceDataProvider.UpdateDailySeries();

            foreach (var series in seriesToUpdate)
            {
                try
                {
                    notification.CurrentMessage = "Updating " + series.Title;
                    _seriesProvider.UpdateSeriesInfo(series.SeriesId);
                    _episodeProvider.RefreshEpisodeInfo(series);
                    notification.CurrentMessage = "Update completed for " + series.Title;
                }

                catch(Exception ex)
                {
                    Logger.ErrorException("Failed to update episode info for series: " + series.Title, ex);
                }
                
            }
        }
开发者ID:Arista2,项目名称:NzbDrone,代码行数:32,代码来源:UpdateInfoJob.cs

示例8: RefreshMetadata

        private void RefreshMetadata(ProgressNotification notification, Series series)
        {
            notification.CurrentMessage = String.Format("Refreshing episode metadata for '{0}'", series.Title);

            Logger.Debug("Getting episodes from database for series: {0}", series.SeriesId);
            var episodeFiles = _mediaFileProvider.GetSeriesFiles(series.SeriesId);

            if (episodeFiles == null || episodeFiles.Count == 0)
            {
                Logger.Warn("No episodes in database found for series: {0}", series.SeriesId);
                return;
            }

            try
            {
                _metadataProvider.CreateForEpisodeFiles(episodeFiles.ToList());
            }

            catch (Exception e)
            {
                Logger.WarnException("An error has occurred while refreshing episode metadata", e);
            }

            notification.CurrentMessage = String.Format("Epsiode metadata refresh completed for {0}", series.Title);
        }
开发者ID:realpatriot,项目名称:NzbDrone,代码行数:25,代码来源:RefreshEpsiodeMetadata.cs

示例9: Start

        public virtual void Start(ProgressNotification notification, int targetId, int secondaryTargetId)
        {
            Logger.Debug("Starting banner download job");


            _diskProvider.CreateDirectory(_enviromentProvider.GetBannerPath());

            if (targetId > 0)
            {
                var series = _seriesProvider.GetSeries(targetId);

                if (series != null && !String.IsNullOrEmpty(series.BannerUrl))
                    DownloadBanner(notification, series);

                return;
            }

            var seriesInDb = _seriesProvider.GetAllSeries();

            foreach (var series in seriesInDb.Where(s => !String.IsNullOrEmpty(s.BannerUrl)))
            {
                DownloadBanner(notification, series);
            }

            Logger.Debug("Finished banner download job");
        }
开发者ID:ShironDrake,项目名称:NzbDrone,代码行数:26,代码来源:BannerDownloadJob.cs

示例10: Start

        public virtual void Start(ProgressNotification notification, int targetId, int secondaryTargetId)
        {
            if (targetId <= 0)
                throw new ArgumentOutOfRangeException("targetId");

            _searchProvider.EpisodeSearch(notification, targetId);
        }
开发者ID:ShironDrake,项目名称:NzbDrone,代码行数:7,代码来源:EpisodeSearchJob.cs

示例11: PartialSeasonSearch

        public virtual List<int> PartialSeasonSearch(ProgressNotification notification, int seriesId, int seasonNumber)
        {
            var series = _seriesProvider.GetSeries(seriesId);

            if (series == null)
            {
                logger.Error("Unable to find an series {0} in database", seriesId);
                return new List<int>();
            }

            if (series.IsDaily)
            {
                logger.Trace("Daily series detected, skipping season search: {0}", series.Title);
                return new List<int>();
            }

            var episodes = _episodeProvider.GetEpisodesBySeason(seriesId, seasonNumber);

            if (episodes == null || episodes.Count == 0)
            {
                logger.Warn("No episodes in database found for series: {0} Season: {1}.", seriesId, seasonNumber);
                return new List<int>();
            }

            return _partialSeasonSearch.Search(series, new {SeasonNumber = seasonNumber, Episodes = episodes}, notification);
        }
开发者ID:realpatriot,项目名称:NzbDrone,代码行数:26,代码来源:SearchProvider.cs

示例12: Start

 public void Start(ProgressNotification notification, dynamic options)
 {
     ExecutionCount++;
     Console.WriteLine("Begin " + Name);
     Start();
     Console.WriteLine("End " + Name);
 }
开发者ID:Normmatt,项目名称:NzbDrone,代码行数:7,代码来源:TestJobs.cs

示例13: Start

        public virtual void Start(ProgressNotification notification, dynamic options)
        {
            notification.CurrentMessage = "Restarting NzbDrone";
            logger.Info("Restarting NzbDrone");

            _iisProvider.StopServer();
        }
开发者ID:realpatriot,项目名称:NzbDrone,代码行数:7,代码来源:AppRestartJob.cs

示例14: SeasonSearch

        public virtual List<int> SeasonSearch(ProgressNotification notification, int seriesId, int seasonNumber)
        {
            var series = _seriesProvider.GetSeries(seriesId);

            if (series == null)
            {
                logger.Error("Unable to find an series {0} in database", seriesId);
                return new List<int>();
            }

            if (series.IsDaily)
            {
                logger.Trace("Daily series detected, skipping season search: {0}", series.Title);
                return new List<int>();
            }

            logger.Debug("Getting episodes from database for series: {0} and season: {1}", seriesId, seasonNumber);
            var episodes = _episodeProvider.GetEpisodesBySeason(seriesId, seasonNumber);

            if (episodes == null || episodes.Count == 0)
            {
                logger.Warn("No episodes in database found for series: {0} and season: {1}.", seriesId, seasonNumber);
                return new List<int>();
            }

            //Todo: Support full season searching
            return new List<int>();
        }
开发者ID:realpatriot,项目名称:NzbDrone,代码行数:28,代码来源:SearchProvider.cs

示例15: SeriesSearch_success

        public void SeriesSearch_success()
        {
            var seasons = new List<int> { 1, 2, 3, 4, 5 };

            WithStrictMocker();

            var notification = new ProgressNotification("Series Search");

            Mocker.GetMock<SeasonProvider>()
                .Setup(c => c.GetSeasons(1)).Returns(seasons);

            Mocker.GetMock<SeasonProvider>()
                .Setup(c => c.IsIgnored(It.IsAny<int>(), It.IsAny<int>())).Returns(false);

            Mocker.GetMock<SeasonSearchJob>()
                .Setup(c => c.Start(notification, 1, It.IsAny<int>())).Verifiable();

            //Act
            Mocker.Resolve<SeriesSearchJob>().Start(notification, 1, 0);

            //Assert
            Mocker.VerifyAllMocks();
            Mocker.GetMock<SeasonSearchJob>().Verify(c => c.Start(notification, 1, It.IsAny<int>()),
                                                       Times.Exactly(seasons.Count));
        }
开发者ID:ShironDrake,项目名称:NzbDrone,代码行数:25,代码来源:SeriesSearchJobTest.cs


注:本文中的NzbDrone.Core.Model.Notification.ProgressNotification类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。