public void EnsureAsyncTFunctionsTimeProperly() { var stat = new StatsdPipeTiming(); stat.TimeIt(() => Task.Factory.StartNew(() => { Thread.Sleep(100); return true; }), "Test"); Thread.Sleep(200); Assert.IsTrue(stat.ElapsedMilliseconds >= 100 && stat.ElapsedMilliseconds < 200); }
public void EnsureActionsTimeProperly() { var stat = new StatsdPipeTiming(); stat.TimeIt(() => Thread.Sleep(200), "Test"); Assert.IsTrue(stat.ElapsedMilliseconds >= 200 && stat.ElapsedMilliseconds < 400); }