Tests.RetryHelperTest.CountTime C# (CSharp) Method

CountTime() public static method

public static CountTime ( Action action ) : long
action Action
return long
        public static long CountTime(Action action)
        {
            var stopwatch = Stopwatch.StartNew();
            action();
            return stopwatch.ElapsedMilliseconds;
        }

Usage Example

Esempio n. 1
0
        public void TestTryUntilWithTryInterval()
        {
            var  times     = 5;
            var  generator = new Generator(times);
            bool result    = false;

            Expect(RetryHelperTest.CountTime(() =>
                                             result = _target.Try(() => generator.Next()).WithTryInterval(RetryHelperTest.Interval * 2).Until(t => t)),
                   EqualTo(RetryHelperTest.Interval * 2 * times).Within(RetryHelperTest.Tolerance));
            Expect(result, True);
        }
All Usage Examples Of Tests.RetryHelperTest::CountTime