Esempio n. 1
0
        public async System.Threading.Tasks.Task StartCrawlerAsyncTestAsync()
        {
            var expectedLink = new Uri("https://venues.hirespace.com/");

            var result = (await _crawler.StartCrawlerAsync(false)).ToList();

            ;

            Assert.IsNotNull(result);
            Assert.IsTrue(result.Count() > 0);
            Assert.IsTrue(result.Any(x => x == expectedLink));
        }
Esempio n. 2
0
        public async System.Threading.Tasks.Task <ActionResult> Index(CrawlerModel model)
        {
            TryUpdateModel(model);
            if (ModelState.IsValid)
            {
                var uri     = new Uri(model.Uri);
                var crawler = new Api.Crawler(uri);
                var result  = await crawler.StartCrawlerAsync(false);

                model.Links = result.Select(x => x.AbsoluteUri).ToList();
            }
            return(View(model));
        }