Exemple #1
0
 private static void InvokeNoAttributes(MethodInfo method, MyTestAttribute myTestAttrib)
 {
     if (method.IsStatic)
     {
         for (var i = 0; i < myTestAttrib.TestCount; i++)
         {
             method.Invoke(null, null);
         }
     }
     else
     {
         for (var i = 0; i < myTestAttrib.TestCount; i++)
         {
             method.Invoke(GetObject(method), null);
         }
     }
 }
Exemple #2
0
        private static void WriteToConsole(MethodInfo method, MyTestAttribute myTestAttrib, Stopwatch timer, object param)
        {
            var avgTime = timer.ElapsedMilliseconds / (double)myTestAttrib.TestCount;

            Console.WriteLine("{0}({1}):\tavgTime = {2} ms = {3} ms / {4}", method.Name, (param != null)?param.ToString():"", avgTime, timer.ElapsedMilliseconds, myTestAttrib.TestCount);
        }