public void LawRepository_LawCommentCount() { var rep = new LawRepository(); foreach (var item in Enumerable.Range(1, 10)) { var bar = rep.CommentCount(654); } var watch = Stopwatch.StartNew(); var comments = rep.CommentCount(654); watch.Stop(); Trace.Write(string.Format("Elapsed {0} milliseconds", watch.ElapsedMilliseconds)); }
private void RunTest(Func<LawRepository, IEnumerable<object>> method) { var rep = new LawRepository(); foreach (var item in Enumerable.Range(1, 10)) { var bar = method(rep).ToList(); } var laws = method(rep); var watch = Stopwatch.StartNew(); var foo = laws.ToList(); watch.Stop(); Trace.Write(string.Format("Elapsed {0} milliseconds", watch.ElapsedMilliseconds)); }