public void TestBrowserDefaultConfig()
 {
     Browser browser = new Browser();
     Assert.AreNotEqual(default(string), browser.Accept);
     Console.WriteLine(browser.Accept);
     Assert.AreNotEqual(default(string), browser.AcceptCharset);
     Assert.AreNotEqual(default(string), browser.AcceptLanguage);
 }
        public Crawler(List<String> Seeds, Browser BrowserToTest, int RecursionLimit)
        {
            this.Seeds = new SortedSet<Uri>();
            foreach (String seed in Seeds.Distinct().ToList())
            {
                // If the Uri is bad, we are not going to attempt to catch the 
                // UriFormatException, this should be reported to the user and
                // not in a test case.
                this.Seeds.Add(new UriComparable(seed));
            }

            if (Seeds.Count != this.Seeds.Count)
                throw new ArgumentException(UNIQUE_SEEDS_ERROR_MESSAGE, "Seeds");

            this.BrowserToTest = BrowserToTest;
            this.RecursionLimit = RecursionLimit;
        }
        public void GenerateTests()
        {
            var creationTimestamp = DateTime.Now;
            // Sets up crawlers.
            List<Crawler> crawlers = new List<Crawler>();
            foreach (BrowserConfigElement browserConfig in Config.Browsers)
            {
                Browser browser = new Browser(browserConfig, Config.NetworkCredentials);

                Crawler crawler = new Crawler(Config.Seeds, browser, Config.RecursionLimit);
                crawlers.Add(crawler);
            }

            // Start crawling.
            var results = new List<HttpRequestResult>();
            foreach (var crawler in crawlers)
            {
                crawler.Crawl();
                results.AddRange(crawler.HttpRequestResults);
            }

            var startTime = DateTime.Now;

            // Creates the test results and writes them to a file.
            var file = new FileInfo(Config.TestResultsFile);
            if (file.Exists) file.Delete();
            var writer = new WebTestXmlWriter();

            var finishTimestamp = DateTime.Now;

            var testRun = (new TestResultsFactory()).GenerateTestRun(Config.Name,
                                                                     Config.Description,
                                                                     startTime,
                                                                     finishTimestamp,
                                                                     creationTimestamp,
                                                                     startTime,
                                                                     results);

            var streamWriter = file.CreateText();
            writer.Write(streamWriter, testRun);
            streamWriter.Flush();
            streamWriter.Close();
            
        }
 public Crawler(SeedCollection Seeds, Browser BrowsertToTest, int RecursionLimit)
     : this((List<String>) Seeds, BrowsertToTest, RecursionLimit)
 {
 }