public void AverageByIterationsTest() { IList <double> values = Enumerable.Range(0, 10000).Select(i => (double)i).ToList(); double iterations = 4; List <double> averagesOut = new List <double>(); var swDict = new Dictionary <string, double>(); MathExtensions.AverageByIterations(values, d => d, (d1, d2) => d1 > d2, iterations); List <double> averagesOut2 = new List <double>(); Stopwatch sw = Stopwatch.StartNew(); MathExtensions.AverageByIterations_(values, d => d, (d1, d2) => d1 > d2, iterations, averagesOut2); swDict.Add("2", sw.ElapsedMilliseconds); sw.Restart(); MathExtensions.AverageByIterations(values, iterations, averagesOut); swDict.Add("1", sw.ElapsedMilliseconds); Debug.WriteLine("{0}:{1:n1}ms" + Environment.NewLine + "{2}", MethodBase.GetCurrentMethod().Name, sw.ElapsedMilliseconds, string.Join(Environment.NewLine, swDict.Select(kv => "\t" + kv.Key + ":" + kv.Value))); Assert.IsFalse(averagesOut.Except(averagesOut2).Any()); }