public static void LogExecutionTime(string numberType, Action testMethod) { var stopWatch = Stopwatch.StartNew(); for (int i = 0; i < ExecutionTimes; i++) { testMethod(); } ResultsLogger.LogResultTime(stopWatch.Elapsed.ToString(), numberType); }
private static void IncrementationTests() { ResultsLogger.Log("Incrementation"); int iNum = 0; TimeLogger.LogExecutionTime("Int", () => { iNum += 1; }); long lNum = 0; TimeLogger.LogExecutionTime("Long", () => { lNum += 1; }); float fNum = 0; TimeLogger.LogExecutionTime("Float", () => { fNum += 1; }); double dNum = 0; TimeLogger.LogExecutionTime("Double", () => { dNum += 1; }); decimal decNum = 0; TimeLogger.LogExecutionTime("Decimal", () => { decNum += 1; }); }