public SearchViewModel(IDownloaderFactory downloaderFactory, INewObject newObject)
 {
     _downloaderFactory = downloaderFactory;
     _newObject = newObject;
     Console.WriteLine(downloaderFactory.Create().GetHashCode());
     Console.WriteLine(downloaderFactory.Create().GetHashCode());
 }
 public AccessLimitedDownloaderFactory(IDownloaderFactory <TKey> downloaderFactory, TimeSpan pageLoadTimout)
 {
     Contract.Requires <ArgumentNullException>(downloaderFactory != null);
     Contract.Requires <ArgumentException>(pageLoadTimout != TimeSpan.Zero);
     _downloaderFactory = downloaderFactory;
     _pageLoadTimout    = pageLoadTimout;
 }
Пример #3
0
        public void GetVDM()
        {
            // Arrange
            IDownloaderFactory downloaderFactory = Mock.Of <IDownloaderFactory>();
            IDownloader        downloader        = Mock.Of <IDownloader>();

            Mock.Get(downloaderFactory)
            .Setup(x => x.Create())
            .Returns(() => downloader);

            Mock.Get(downloader)
            .Setup(x => x.DownloadString("https://www.viedemerde.fr"))
            .Returns(() => File.ReadAllText("viedemerde.html"));

            // Act
            VieDeMerdeService    query = new VieDeMerdeService(downloaderFactory);
            VieDeMerdeCollection vdms  = query.GetLastVieDeMerdes();

            // Assert
            Assert.AreEqual(30, vdms.VieDemerde.Length);
            Assert.AreEqual("Le trottoir c'est pas pour les chiens", vdms.VieDemerde[0].Titre);
            Assert.AreEqual("lau", vdms.VieDemerde[0].Auteur);

            Assert.AreEqual("Dernier recours", vdms.VieDemerde[1].Titre);
            Assert.AreEqual("Anonyme", vdms.VieDemerde[1].Auteur);

            Assert.AreEqual("Dictature", vdms.VieDemerde[2].Titre);
            Assert.AreEqual("Plante verte", vdms.VieDemerde[2].Auteur);
        }
 public DownloadAppInstaller(IConsoleLogger consoleLogger,
                             IPowerShell powerShell,
                             IDownloaderFactory downloaderFactory)
 {
     this.consoleLogger     = consoleLogger;
     this.powerShell        = powerShell;
     this.downloaderFactory = downloaderFactory;
 }
Пример #5
0
 public SchedulerContext(IMonitorableScheduler scheduler,
                         IDownloaderFactory downloaderFactory,
                         IResultItemPipeline resultItemPipeline,
                         IPageAnalyzerFactory pageAnalyzerFactory)
 {
     Scheduler           = scheduler;
     DownloaderFactory   = downloaderFactory;
     ResultPipeline      = resultItemPipeline;
     PageAnalyzerFactory = pageAnalyzerFactory;
 }
Пример #6
0
 public CrawlerController(IShellService shellService, IManagerService managerService, ICrawlerService crawlerService,
                          IDownloaderFactory downloaderFactory, Lazy <CrawlerViewModel> crawlerViewModel)
 {
     this.shellService     = shellService;
     this.managerService   = managerService;
     this.crawlerService   = crawlerService;
     this.crawlerViewModel = crawlerViewModel;
     DownloaderFactory     = downloaderFactory;
     crawlCommand          = new AsyncDelegateCommand(Crawl, CanCrawl);
     pauseCommand          = new DelegateCommand(Pause, CanPause);
     resumeCommand         = new DelegateCommand(Resume, CanResume);
     stopCommand           = new DelegateCommand(Stop, CanStop);
     runningTasks          = new List <Task>();
     lockObject            = new object();
 }
Пример #7
0
        /// <summary>
        /// Constructor for NCrawler
        /// </summary>
        /// <param name="crawlStart">The url from where the crawler should start</param>
        /// <param name="pipeline">Pipeline steps</param>
        public Crawler(Uri crawlStart, params IPipelineStep[] pipeline)
        {
            AspectF.Define.
            NotNull(crawlStart, "crawlStart").
            NotNull(pipeline, "pipeline");

            m_LifetimeScope     = NCrawlerModule.Container.BeginLifetimeScope();
            m_DownloaderFactory = m_LifetimeScope.Resolve <IDownloaderFactory>();
            m_BaseUri           = crawlStart;
            MaximumCrawlDepth   = null;
            AdhereToRobotRules  = true;
            MaximumThreadCount  = 1;
            Pipeline            = pipeline;
            UserAgent           = "NCrawler";
            DownloadDelay       = null;
            UriSensitivity      = UriComponents.HttpRequestUrl;
        }
Пример #8
0
        /// <summary>
        /// Constructor for NCrawler
        /// </summary>
        /// <param name="crawlStart">The url from where the crawler should start</param>
        /// <param name="pipeline">Pipeline steps</param>
        public Crawler(Uri crawlStart, params IPipelineStep[] pipeline)
        {
            AspectF.Define.
                NotNull(crawlStart, "crawlStart").
                NotNull(pipeline, "pipeline");

            m_LifetimeScope = NCrawlerModule.Container.BeginLifetimeScope();
            m_DownloaderFactory = m_LifetimeScope.Resolve<IDownloaderFactory>();
            m_BaseUri = crawlStart;
            MaximumCrawlDepth = null;
            AdhereToRobotRules = true;
            MaximumThreadCount = 1;
            Pipeline = pipeline;
            UserAgent = "NCrawler";
            DownloadDelay = null;
            UriSensitivity = UriComponents.HttpRequestUrl;
        }
Пример #9
0
 public ManagerController(IShellService shellService, ISelectionService selectionService, ICrawlerService crawlerService,
                          IManagerService managerService, IDownloaderFactory downloaderFactory, Lazy <ManagerViewModel> managerViewModel)
 {
     this.shellService      = shellService;
     this.selectionService  = selectionService;
     this.crawlerService    = crawlerService;
     this.managerService    = managerService;
     this.managerViewModel  = managerViewModel;
     DownloaderFactory      = downloaderFactory;
     blogFiles              = new ObservableCollection <Blog>();
     addBlogCommand         = new AsyncDelegateCommand(AddBlog, CanAddBlog);
     removeBlogCommand      = new DelegateCommand(RemoveBlog, CanRemoveBlog);
     showFilesCommand       = new DelegateCommand(ShowFiles, CanShowFiles);
     visitBlogCommand       = new DelegateCommand(VisitBlog, CanVisitBlog);
     enqueueSelectedCommand = new DelegateCommand(EnqueueSelected, CanEnqueueSelected);
     listenClipboardCommand = new DelegateCommand(ListenClipboard);
     autoDownloadCommand    = new DelegateCommand(EnqueueAutoDownload, CanEnqueueAutoDownload);
     showDetailsCommand     = new DelegateCommand(ShowDetailsCommand);
 }
Пример #10
0
 public Controller(IResourceLog resourceLog, IContentParserFactory contentParserFactory, IDownloaderFactory downloaderFactory)
 {
     this.ResourceLog          = resourceLog;
     this.ContentParserFactory = contentParserFactory;
     this.DownloaderFactory    = downloaderFactory;
 }
Пример #11
0
 public SearchViewModel(IDownloaderFactory factory)
     : base(model)
 {
     _factory = factory;
 }
 /// <summary>
 /// Constructeur paramétrable.
 ///
 /// Chaque dépendance peut être passée en tant que paramètre. Cela permet d'injecter
 /// les dépendances à la construction de l'objet. Utile pour les tests unitaires.
 /// </summary>
 /// <param name="downloaderFactory"></param>
 public VieDeMerdeService(IDownloaderFactory downloaderFactory)
 {
     _downloaderFactory = downloaderFactory;
 }
Пример #13
0
 public IController Create(IResourceLog resourceLog, IContentParserFactory contentParserFactory, IDownloaderFactory downloaderFactory)
 {
     throw new NotImplementedException();
 }
Пример #14
0
 public GoogleLanguageDetection()
 {
     m_DownloaderFactory = NCrawlerModule.Container.Resolve<IDownloaderFactory>();
 }
Пример #15
0
 public GoogleLanguageDetection()
 {
     m_DownloaderFactory = NCrawlerModule.Container.Resolve <IDownloaderFactory>();
 }
 public CachedDownloaderFactory(IDownloaderFactory <TKey> downloaderFactory)
 {
     Contract.Requires <ArgumentNullException>(downloaderFactory != null);
     _downloaderFactory = downloaderFactory;
     _downloaders       = new ConcurrentDictionary <TKey, IDownloader>();
 }