示例#1
0
        static void Main(string[] args)
        {
            // Create the test runner. Configure it to run lots of tests in parallel.
            var tester = new TestRunner
            {
                ParallelTests = 128
            };

            // Get a chunk of data
            var data = MakeData();

            // Test how fast we can copy that data
            tester.AddTest(() => {
                var dataCopy = new byte[data.Length];
                data.CopyTo(dataCopy, 0);

                // This test can not fail, so always report success.
                return true;
            });

            // Run the test
            tester.Start();

            // Print status information every second
            while(true)
            {
                Thread.Sleep(1000);
                Console.WriteLine(String.Format(
                    "Requests: {0} ({1:0.00}/s), Errors: {2} ({3:0.00}%), ",
                    tester.TotalTestsExecuted,
                    tester.TotalTestsExecuted / tester.TotalSeconds,
                    tester.TotalErrors,
                    100.0 * (double)tester.TotalErrors / tester.TotalTestsExecuted
                ));
            }
        }