예제 #1
0
        /// <summary>
        /// Indicates the main entry into the application.
        /// </summary>
        /// <param name="args">The args.</param>
        static void Main(string[] args)
        {
            // Create the performance runner.
            var runner = new Runner();
            runner.StatusListener.Listeners.Add(new ConsoleStatusListener());

            // Go through the arguments and load each one through the
            // assembly loader or set up the command-line arguments.
            foreach (string arg in args)
            {
                // See if this is a DLL or EXE file.
                if (File.Exists(arg))
                {
                    // Load the assembly into the runner.
                    runner.LoadAssembly(arg);
                }
            }

            // Once we are done loading, perform the actual performance
            // testing of the various units.
            runner.Run();

            Console.Write("Done.");
            Console.ReadKey();
        }
예제 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TypeRunner"/> class.
        /// </summary>
        /// <param name="runner">The runner.</param>
        /// <param name="type">The type.</param>
        public TypeRunner(Runner runner, Type type)
        {
            // Make sure the parameters are not null.
            if (runner == null)
            {
                throw new ArgumentNullException("runner");
            }
            if (type == null)
            {
                throw new ArgumentNullException("type");
            }

            // Save the values in the container.
            this.runner = runner;
            this.type = type;

            // Report the assembly is loading.
            runner.StatusListener.StartLoadingType(type);

            try
            {
                // Create the fixture object.
                CreateFixture();

                if (fixture == null)
                {
                    return;
                }

                // Go through all the methods within the type.
                foreach (MethodInfo method in type.GetMethods())
                {
                    // Figure out the signature of this method.
                    ParseMethod(method);
                }

                // Set up the baselines if we don't have one.
                AssignDefaultBaselines();
            }
            finally
            {
                // Report the end of the type loading.
                runner.StatusListener.EndLoadingType(type);
            }
        }