Esempio n. 1
0
        public void WriteSiteMapFromXml_MustCorrectConvertXmlDoc()
        {
            var xmlDoc = new XmlDocument();

            xmlDoc.Load(AppDomain.CurrentDomain.BaseDirectory + @"\sitemap.xml");

            IConvertService convertService = new ConvertService();

            Assert.IsNotNull(convertService.WriteSiteMapFromXml(xmlDoc));
        }
Esempio n. 2
0
        public void WriteSiteMapFromXml_MustCorrectConvertXmlDocAndContains()
        {
            var xmlDoc = new XmlDocument();

            xmlDoc.Load(AppDomain.CurrentDomain.BaseDirectory + @"\sitemap.xml");

            IConvertService convertService = new ConvertService();

            var siteMapModel = convertService.WriteSiteMapFromXml(xmlDoc);

            Assert.IsTrue(siteMapModel.urlset.url.Any(v => v.loc == "https://www.mvideo.ru/prigotovlenie-kofe-29-29/kofemashiny-155/f/collection_top=delonghi-magnifica"));
        }
Esempio n. 3
0
        static void Main(string[] args)
        {
            ILogger          logger          = new Logger();
            IBrowserService  browserService  = new BrowserPoolService();
            IConvertService  convertService  = new ConvertService();
            IDocumentService documentService = new DocumentService();
            IXmlReadService  xmlReadService  = new XmlReadService();

            IProductsPageParseService productsPageParseService = new ProductsPageParseService(logger, browserService, convertService);

            IRegionChangeService regionChangeService = new RegionChangeService(browserService);

            regionChangeService.ChangeRegion(ConfigurationManager.AppSettings["regionname"]);

            convertService.GetUniqCategoriesFromSiteMap(convertService.WriteSiteMapFromXml(xmlReadService.DownloadXml())).ToList().ForEach(c =>
            {
                documentService.WriteProductsInExcel(logger, productsPageParseService.GetProducts(c.loc), convertService.GetSafeFilename(c.loc));
            });
        }
Esempio n. 4
0
        public void GetUniqCategoriesFromSiteMap_MustCorrectCreateUniqList()
        {
            var xmlDoc = new XmlDocument();

            xmlDoc.Load(AppDomain.CurrentDomain.BaseDirectory + @"\sitemap.xml");

            IConvertService convertService = new ConvertService();

            var siteMapModel = convertService.WriteSiteMapFromXml(xmlDoc);

            IEnumerable <Category> uniqCategoriesAfterConvert = convertService.GetUniqCategoriesFromSiteMap(siteMapModel);

            for (var index = 1; index < uniqCategoriesAfterConvert.ToList().Count; index++)
            {
                var previous = uniqCategoriesAfterConvert.ToList()[index - 1];
                var current  = uniqCategoriesAfterConvert.ToList()[index];
                if (current == previous)
                {
                    Assert.Fail("Нашёлся дубль в ссылках.");
                }
            }
        }