public void TechnologyFinderRunCrawlerCantCrashWithABadURL()
 {
     FileStream patternsFile = new FileStream(AppDomain.CurrentDomain.BaseDirectory + @"\\MagentoStringPatterns.txt", FileMode.Open);
     ITechnology technology = new Technology("Magento", patternsFile);
     List<string> badURL = new List<string> { "w1jafpi3rvcdf" };
     TechnologyFinder finder = new TechnologyFinder(technology, badURL);
     finder.RunCrawler();
 }
 public void TechnologyFinderMustSetupTechnologyOnConstructor()
 {
     FileStream patternsFile = new FileStream(AppDomain.CurrentDomain.BaseDirectory + @"\\MagentoStringPatterns.txt", FileMode.Open);
     ITechnology technology = new Technology("Magento", patternsFile);
     FileStream sitesFile = new FileStream(System.AppDomain.CurrentDomain.BaseDirectory + @"\\MagentoSitesURLs.txt", FileMode.Open);
     SitesLoader sitesLoader = new SitesLoader(sitesFile);
     TechnologyFinder finder = new TechnologyFinder(technology, sitesLoader.SitesURLs);
     Assert.IsNotNull(finder);
 }
        public void TechnologyFinderRunCrawlerOnShopify()
        {
            ITechnology technology;
            SitesLoader sitesLoader;
            SetupShopifyTechnology(out technology, out sitesLoader);

            TechnologyFinder finder = new TechnologyFinder(technology, sitesLoader.SitesURLs);
            finder.RunCrawler();

            Assert.AreEqual(5, finder.SiteURLsWithTheTechnology.Count);
        }
        public void TechnologyFinderRunCrawlerOnMagento()
        {
            FileStream patternsFile = new FileStream(AppDomain.CurrentDomain.BaseDirectory + @"\\MagentoStringPatterns.txt", FileMode.Open);
            ITechnology technology = new Technology("Magento", patternsFile);
            FileStream sitesFile = new FileStream(AppDomain.CurrentDomain.BaseDirectory + @"\\MagentoSitesURLs.txt", FileMode.Open);
            SitesLoader sitesLoader = new SitesLoader(sitesFile);

            TechnologyFinder finder = new TechnologyFinder(technology, sitesLoader.SitesURLs);
            finder.RunCrawler();
            Assert.AreEqual(7, finder.SiteURLsWithTheTechnology.Count);
            finder.WriteFoundSites();
        }
        public void TechnologyFinderRunCrawlerCreatesFoldersOKNOTandNA()
        {
            ITechnology technology;
            SitesLoader sitesLoader;
            SetupShopifyTechnology(out technology, out sitesLoader);

            TechnologyFinder finder = new TechnologyFinder(technology, sitesLoader.SitesURLs);
            finder.RunCrawler();

            Assert.IsTrue(Directory.Exists(AppDomain.CurrentDomain.BaseDirectory + technology.Name + "\\OK"));
            Assert.IsTrue(Directory.Exists(AppDomain.CurrentDomain.BaseDirectory + technology.Name + "\\NOTOK"));
            Assert.IsTrue(Directory.Exists(AppDomain.CurrentDomain.BaseDirectory + technology.Name + "\\NA"));
        }
        public void TechnologyFinderSaveMainPageSourceToTechonologySubFolderNOTOK()
        {
            ITechnology technology;
            SitesLoader sitesLoader;
            SetupShopifyTechnology(out technology, out sitesLoader);

            TechnologyFinder finder = new TechnologyFinder(technology, sitesLoader.SitesURLs);
            finder.RunCrawler();

            int sourcePagesCount = Directory.GetFiles(AppDomain.CurrentDomain.BaseDirectory + technology.Name + "\\NOTOK").Length;
            Assert.AreEqual(3, sourcePagesCount);
        }