Example #1
0
        private string extractDomain(string htmlSection)
        {
            Regex          pageRX         = new Regex("(?<=<cite>)(.*?)(?=<)");
            EndPointClient endPointClient = new EndPointClient();

            return(endPointClient.extractBaseDomain(pageRX.Match(htmlSection).Value));
        }
Example #2
0
        private string extractDomain(string htmlSection)
        {
            Regex          pageRX         = new Regex("(?<=<div class=\"BNeawe UPmit AP7Wnd\">)(.*?)(?=<)");
            EndPointClient endPointClient = new EndPointClient();

            return(endPointClient.extractBaseDomain(pageRX.Match(htmlSection).Value));
        }
Example #3
0
        public void extractedBaseDomainTest()
        {
            string[] urlitems =
            {
                "https://www.test.com.au/pages.aspx",
                "https://www.test.com.au/pages",
                "https://www.test.com/pages",
                "https://www.test.com",
                "www.test.com.au/pages",
                "www.test.com.au",
                "www.test.com/pages",
                "www.test.com",
                "test.com.au",
                "test.com.au/pages",
                "test.com/pages",
                "test.com",
            };
            string[] expected =
            {
                "test.com.au",
                "test.com.au",
                "test.com",
                "test.com",
                "test.com.au",
                "test.com.au",
                "test.com",
                "test.com",
                "test.com.au",
                "test.com.au",
                "test.com",
                "test.com",
            };
            List <string> expectedURL   = new List <string>(expected);
            List <string> extractedTest = new List <string>();

            foreach (string url in urlitems)
            {
                EndPointClient endPointClient = new EndPointClient();
                string         extractUrl     = endPointClient.extractBaseDomain(url);
                extractedTest.Add(extractUrl);
            }
            Assert.Equal <string>(expectedURL, extractedTest);
        }