Ejemplo n.º 1
0
        private void DoWork(object state)
        {
            ProDjShopUrlCollector collector = new ProDjShopUrlCollector();
            List <string>         strings   = new List <string>();

            ProDjShopUrlCollectorSettings collectorSettings = new ProDjShopUrlCollectorSettings();
            UrlCollectorWorker <string[]> worker            = new UrlCollectorWorker <string[]>(collector, collectorSettings);

            worker.Settings = collectorSettings;
            worker.Start();
            ProductParserWorker productParserWorker = new ProductParserWorker(db);

            worker.OnNewData += productParserWorker.DoWork;

            _logger.LogDebug("Timed Background Service is working." + (_counter++.ToString()));
        }
Ejemplo n.º 2
0
        public async void UrlCollectLoaderTestHtmsPageAsString()
        {
            // Arrange
            ProDjShopUrlCollectorSettings settings = new ProDjShopUrlCollectorSettings();
            UrlCollectLoader loader = new UrlCollectLoader(settings);
            int pageId = 5;


            // Act
            var result = await loader.GetSourceByPageIdAsync(pageId);


            // Assert
            Assert.NotNull(result);
            Assert.IsType <string>(result);
            Assert.NotEmpty(result);
        }
        public async void UrlCollectLoaderTestHtmsPageAsString()
        {
            // Arrange
            ProDjShopUrlCollectorSettings collectorSettings = new ProDjShopUrlCollectorSettings();
            ProDjShopUrlCollector         collector         = new ProDjShopUrlCollector();
            UrlCollectorWorker <string[]> worker            = new UrlCollectorWorker <string[]>(collector, collectorSettings);

            worker.Settings = collectorSettings;
            object obj = new object();

            string[] urls = new string[] { "https://www.prodj.com.ua/studio-monitors/monkey-banana-gibbon-5-banana.html" };


            // Act
            worker.Start();

            //todo: asserts
            // Assert
            //Assert.NotNull(result);
            //Assert.IsType<string>(result);
            //Assert.NotEmpty(result);
        }