示例#1
0
 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);
 }
示例#2
0
        public void EnsureActionsTimeProperly()
        {
            var stat = new StatsdPipeTiming();
            stat.TimeIt(() => Thread.Sleep(200), "Test");

            Assert.IsTrue(stat.ElapsedMilliseconds >= 200 && stat.ElapsedMilliseconds < 400);
        }