Ejemplo n.º 1
0
        public void RunPerfTests()
        {
            string[] files = Directory.GetFiles(@"c:\temp\trash", "*.htm", SearchOption.AllDirectories);
            System.Diagnostics.Stopwatch sw;

            for (int i = 0; i < 10; i++)
            {
                //HTML Parser
                sw = new System.Diagnostics.Stopwatch();
                sw.Start();

                foreach (string file in files)
                {
                    new HtmlLightDocument(File.ReadAllText(file));
                }

                Console.WriteLine("HTML = {0}", sw.ElapsedMilliseconds);
                //XML Parser
                sw = new System.Diagnostics.Stopwatch();
                sw.Start();

                foreach (string file in files)
                {
                    new XmlLightDocument(File.ReadAllText(file));
                }

                Console.WriteLine("XHTM = {0}", sw.ElapsedMilliseconds);
                //Parse Only
                sw = new System.Diagnostics.Stopwatch();
                sw.Start();

                IXmlLightReader rdr = new EmptyReader();
                foreach (string file in files)
                {
                    XmlLightParser.Parse(File.ReadAllText(file), XmlLightParser.AttributeFormat.Xml, rdr);
                }

                Console.WriteLine("NDOM = {0}", sw.ElapsedMilliseconds);
                //Text Only
                sw = new System.Diagnostics.Stopwatch();
                sw.Start();

                foreach (string file in files)
                {
                    XmlLightParser.ParseText(File.ReadAllText(file));
                }

                Console.WriteLine("TEXT = {0}", sw.ElapsedMilliseconds);
            }
        }
 public void ReadPaddedString_Should_Throw_When_Padding_Is_Non_Positive(int padding)
 {
     EmptyReader
     .Invoking(r => r.ReadPaddedString(padding))
     .ShouldThrow <ArgumentOutOfRangeException>();
 }
Ejemplo n.º 3
0
		public void RunPerfTests()
		{
			string[] files = Directory.GetFiles(@"c:\temp\trash", "*.htm", SearchOption.AllDirectories);
			System.Diagnostics.Stopwatch sw;

			for (int i = 0; i < 10; i++)
			{
				//HTML Parser
				sw = new System.Diagnostics.Stopwatch();
				sw.Start();

				foreach (string file in files)
					new HtmlLightDocument(File.ReadAllText(file));

				Console.WriteLine("HTML = {0}", sw.ElapsedMilliseconds);
				//XML Parser
				sw = new System.Diagnostics.Stopwatch();
				sw.Start();

				foreach (string file in files)
					new XmlLightDocument(File.ReadAllText(file));

				Console.WriteLine("XHTM = {0}", sw.ElapsedMilliseconds);
				//Parse Only
				sw = new System.Diagnostics.Stopwatch();
				sw.Start();

				IXmlLightReader rdr = new EmptyReader();
				foreach (string file in files)
					XmlLightParser.Parse(File.ReadAllText(file), XmlLightParser.AttributeFormat.Xml, rdr);

				Console.WriteLine("NDOM = {0}", sw.ElapsedMilliseconds);
				//Text Only
				sw = new System.Diagnostics.Stopwatch();
				sw.Start();

				foreach (string file in files)
					XmlLightParser.ParseText(File.ReadAllText(file));

				Console.WriteLine("TEXT = {0}", sw.ElapsedMilliseconds);
			}
		}
 public void Skip_Should_Throw_When_Count_Is_Negative()
 {
     EmptyReader
     .Invoking(r => r.Skip(-1))
     .ShouldThrow <ArgumentOutOfRangeException>();
 }