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


C# Service.Scrape方法代码示例

本文整理汇总了C#中Service.Scrape方法的典型用法代码示例。如果您正苦于以下问题:C# Service.Scrape方法的具体用法?C# Service.Scrape怎么用?C# Service.Scrape使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Service的用法示例。


在下文中一共展示了Service.Scrape方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CanPersistComparison

        //[Test]
        public void CanPersistComparison()
        {
            //Arrange
            var qbService = new Service();
            var myScrapeA = qbService.Scrape("www.google.com", false);
            var myScrapeB = qbService.Scrape("www.google.com", false);

            //Act
            var comparer = new Comparer();
            var myComparison = comparer.Compare(myScrapeA, myScrapeB);

            //Assert
            Assert.IsTrue(!String.IsNullOrEmpty(myComparison.Id.ToString()), "Comparison Id is Null or Empty: {0}", myComparison.Id.ToString());
        }
开发者ID:Ancestry,项目名称:quality-bot,代码行数:15,代码来源:ServiceTests.cs

示例2: CanPersistScrape

        //[Test]
        public void CanPersistScrape()
        {
            //Arrange
            var qbService = new Service();

            //Act
            var myScrape = qbService.Scrape("www.google.com");

            //Assert
            Assert.IsTrue(!String.IsNullOrEmpty(myScrape.Id.ToString()));
        }
开发者ID:Ancestry,项目名称:quality-bot,代码行数:12,代码来源:ServiceTests.cs

示例3: CanCompareScrapes

        //[Test]
        public void CanCompareScrapes()
        {
            //Arrange
            var tmpScraper = new Service();
            var tmpScrapeA = tmpScraper.Scrape(new Request("www.ancestry.com"));
            var tmpMongoIdA = new MongoDB.Bson.ObjectId(DateTime.Now, 0, 0, 0);
            tmpScrapeA.Id = tmpMongoIdA;

            var tmpScrapeB = tmpScraper.Scrape(new Request("www.ancestrystage.com"));
            var tmpMongoIdB = new MongoDB.Bson.ObjectId(DateTime.Now, 0, 0, 0);
            tmpScrapeB.Id = tmpMongoIdB;

            //Act
            var qbService = new Comparer();
            var retvalComparison = qbService.Compare(tmpScrapeA, tmpScrapeB);

            //Assert
            Assert.AreEqual(retvalComparison.Scrapes[0].IdString, tmpScrapeA.IdString, "Compare failed: Invalid ScrapeIDs Expected: {0}", tmpMongoIdA);
            Assert.AreEqual(retvalComparison.Scrapes[1].IdString, tmpScrapeB.IdString, "Compare failed: Invalid ScrapeIDs Expected: {0}", tmpMongoIdB);
        }
开发者ID:Ancestry,项目名称:quality-bot,代码行数:21,代码来源:ServiceTests.cs

示例4: VerifyScrapeWithPhantomJS

        //[Test, Category("Integration")]
        public void VerifyScrapeWithPhantomJS()
        {
            //Arrange
            var qbService = new Service();
            var request = new Request
            {
                Url = "http://www.google.com/",
                Browser = "phantomjs"
            };

            //Act & Assert
            Assert.DoesNotThrow(() =>
            {
                var result = qbService.Scrape(request);
                Assert.IsTrue(result.Url == request.Url);
                Assert.IsTrue(result.Browser == request.Browser);
            });
        }
开发者ID:Ancestry,项目名称:quality-bot,代码行数:19,代码来源:ServiceTests.cs

示例5: Scrape

        /// HELPER METHODS ///
        private Scrape Scrape(Request request)
        {
            var scraper = new Service();
            var scrape = scraper.Scrape(request);

            return scrape;
        }
开发者ID:Ancestry,项目名称:quality-bot,代码行数:8,代码来源:PersisterTests.cs

示例6: TestSaveScrapeToFileSystem

        //[Test]
        public void TestSaveScrapeToFileSystem()
        {
            var url = "http://www.google.com?timestamp=" + GetTimestamp();

            var scraper = new Service();
            var request = new Request(url, _browser, _browserVersion, _resolution);
            var scrape = scraper.Scrape(request);

            var persister = PersisterFactory.CreateScrapePersisterInstance(@"C:\OutputDirectory\TestSaveScrapeToFileSystem");

            // cleanup
            if (Directory.Exists(persister.OutputDir)) Directory.Delete(persister.OutputDir, true);

            // save
            persister.Save(scrape);

            // verify
            Assert.IsTrue(Directory.Exists(persister.OutputDir));

            var files = Directory.GetFiles(persister.OutputDir);
            Assert.IsTrue(files.Any(f => f.Contains("Html.html")));
            Assert.IsTrue(files.Any(f => f.Contains("scrape.json")));
            Assert.IsTrue(files.Any(f => f.Contains("Screenshot.png")));
        }
开发者ID:Ancestry,项目名称:quality-bot,代码行数:25,代码来源:PersisterTests.cs

示例7: Scrape

        public dynamic Scrape(string url, bool persist)
        {
            var qBSvc = new Service();

            return qBSvc.Scrape(url, persist);
        }
开发者ID:Ancestry,项目名称:quality-bot,代码行数:6,代码来源:QualityBotService.cs


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