Esempio n. 1
0
        static void FullProgramTest()
        {
            string course1 = "PROG W555W";
            string course2 = "PROG 55294";
            string course3 = "PROG 43544";

            string regex1 = RegexBuilder.GenerateRegex(course1);
            string regex2 = RegexBuilder.GenerateRegex(course2);
            string regex3 = RegexBuilder.GenerateRegex(course3);

            Console.WriteLine($"Course1:{course1} - Regex:{regex1}, Course2:{course2} - Regex:{regex2}.");
            var list = new List <string>();

            list.Add(regex1);
            list.Add(regex2);
            // do not need to add regex for course codes that are similar(or same regex)
            string sampledoc = $"" +
                               $"<!DOCTYPE html>" +
                               $"<html>" +
                               $"<head>" +
                               $"</head>" +
                               $"<body>" +
                               $"<table id='test'>" +
                               $"<tr><td>Prof Jame {course1} <span id='substitute'>Prof Shiva</span> 10/10/2019 - 10/10/2020 10:30 </td></tr>" +
                               $"<!--<tr><td>Prof Snadra {course2} 10/15/2019 - 10/15/2020 10:30 </td></tr>-->" +
                               $"<!--<tr><td>Prof Klams {course3} 10/13/2019 - 10/13/2020 10:30 </td></tr>-->" +
                               $"</table>" +
                               $"<p>Hello!<p>" +
                               $"</body>" +
                               $"</html>";

            Parse(sampledoc, list);
        }
Esempio n. 2
0
        static string GenerateRegexTest()
        {
            string course = "1X 11 S3";
            string regex  = RegexBuilder.GenerateRegex(course);

            Console.WriteLine("For the course code " + course + ". Regex is " + regex);
            //TODO: check if expected == result
            return(regex);
        }