Ejemplo n.º 1
0
        public void TestExtractLinkToPages()
        {
            var paginationLinkMiner = new PaginationLinkMiner(page);
            var urls = paginationLinkMiner.Extract(Download(page));

            Assert.That(urls, Is.EquivalentTo(new[]
            {
                "http://www.mtk.ru/business/sale/business/?p=1",
                "http://www.mtk.ru/business/sale/business/?p=2",
                "http://www.mtk.ru/business/sale/business/?p=3",
                "http://www.mtk.ru/business/sale/business/?p=4",
                "http://www.mtk.ru/business/sale/business/?p=5"
            }));

            Console.WriteLine(urls.Aggregate("", (acc, url) => $"{acc}\n{url}"));
        }
Ejemplo n.º 2
0
        public void ExtractTest()
        {
            var ajax = @"
	                    $('#paginator').paginator({
		                    pagesTotal: 3, 
		                    pagesSpan: 10, 
		                    pageCurrent: pagesArr, 
		                    baseUrl: 'pages=%number%',
		                    pageScroll: 3,
		                    events: {
			                    keyboard: false,
			                    scroll: true
		                    }
	                    });"    ;

            Assert.That(paginationLinkMiner.Extract(ajax), Is.EquivalentTo(new []
            {
                "http://www.mtk.ru/business/sale/business/?p=1",
                "http://www.mtk.ru/business/sale/business/?p=2",
                "http://www.mtk.ru/business/sale/business/?p=3",
            }));
        }