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); } } }
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); }