public void AddMatches_EmptyList_NoAdditional()
        {
            // Arrange:
            var url = new Uri("http://www.uncas.dk");
            var crawlConfiguration =
                new CrawlConfiguration(
                    url,
                    10);

            // Act:
            crawlConfiguration.AddMatches(null);

            // Assert:
            Assert.That(
                crawlConfiguration.MatchPatterns.Count(),
                Is.EqualTo(1));
        }
        public void AddMatches_TwoItemsInList_TwoAdditional()
        {
            // Arrange:
            var url = new Uri("http://www.uncas.dk");
            var crawlConfiguration =
                new CrawlConfiguration(
                    url,
                    10);

            // Act:
            crawlConfiguration.AddMatches(new string[] { "x", "y" });

            // Assert:
            Assert.That(
                crawlConfiguration.MatchPatterns.Count(),
                Is.EqualTo(3));
        }
        /// <summary>
        /// Parses the command line arguments.
        /// </summary>
        /// <param name="args">The command line arguments.</param>
        /// <returns>The crawl configuration.</returns>
        /// <remarks>
        /// Command line arguments, with default values:
        /// -url http://localhost -maxPages 10.
        /// </remarks>
        public static ICrawlConfiguration ParseArguments(
            IList<string> args)
        {
            string url = GetStartUrl(args);
            int? maxPages = GetMaxPages(args);

            var result = new CrawlConfiguration(
                new Uri(url),
                maxPages);
            string matches = CombinationParser.GetValue(
                args, "matches", "matches", string.Empty);
            if (!string.IsNullOrEmpty(matches))
            {
                string[] matchList =
                    matches.Split(
                    new char[] { ',' },
                    StringSplitOptions.RemoveEmptyEntries);
                result.AddMatches(matchList);
            }

            return result;
        }