Beispiel #1
0
        public static void RunTest(string html)
        {
            HtmlValidatorWithXSD validator = new HtmlValidatorWithXSD();

            while (true)
            {
                Console.Write("input a number to run times: ");
                string v = Console.ReadLine().Trim();
                if (v.Equals("q", StringComparison.OrdinalIgnoreCase))
                {
                    break;
                }
                int times = 1;
                //if (int.TryParse(v, out times) == false) continue;
                DateTime dt1 = DateTime.Now;
                string   msg = string.Empty;
                for (int i = 0; i < times; i++)
                {
                    if (!string.IsNullOrEmpty(v))
                    {
                        validator.Validate(v);
                        //msg = HtmlTagValidator.checkHtmlTags(html);
                        Console.WriteLine("result:{0}", msg);
                    }
                    else
                    {
                        foreach (string tag in TestData)
                        {
                            validator.Validate(tag);
                            Console.WriteLine("result:{0}", msg);
                        }
                    }
                }
                DateTime dt2 = DateTime.Now;
                Console.WriteLine("run times:{0},millionsecond:{1}ms", times, (dt2 - dt1).TotalMilliseconds);
                Console.WriteLine();
            }
        }
 public static void RunTest(string html)
 {
     HtmlValidatorWithXSD validator = new HtmlValidatorWithXSD();
     while (true)
     {
         Console.Write("input a number to run times: ");
         string v = Console.ReadLine().Trim();
         if (v.Equals("q", StringComparison.OrdinalIgnoreCase))
         {
             break;
         }
         int times = 1;
         //if (int.TryParse(v, out times) == false) continue;
         DateTime dt1 = DateTime.Now;
         string msg = string.Empty;
         for (int i = 0; i < times; i++)
         {
             if (!string.IsNullOrEmpty(v))
             {
                 validator.Validate(v);
                 //msg = HtmlTagValidator.checkHtmlTags(html);
                 Console.WriteLine("result:{0}", msg);
             }
             else
             {
                 foreach (string tag in TestData)
                 {
                     validator.Validate(tag);
                     Console.WriteLine("result:{0}", msg);
                 }
             }
         }
         DateTime dt2 = DateTime.Now;
         Console.WriteLine("run times:{0},millionsecond:{1}ms", times, (dt2 - dt1).TotalMilliseconds);
         Console.WriteLine();
     }
 }