public virtual void TestLoopWithTimeoutReturnsAfterTimeout()
		{
			StopWatch watch = new AutoStopWatch();
			Runtime4.Retry(500, new _IClosure4_24());
			watch.Stop();
			Assert.IsGreaterOrEqual(500, watch.Elapsed());
		}
 private static long Time(IProcedure4 procedure4)
 {
     var storage = new PagingMemoryStorage();
     StoreItems(storage);
     StopWatch stopWatch = new AutoStopWatch();
     for (var i = 0; i < Iterations; ++i)
     {
         ApplyProcedure(storage, procedure4);
     }
     return stopWatch.Peek();
 }
Example #3
0
 public static bool Retry(long millisecondsTimeout, int millisecondsBetweenRetries
     , IClosure4 block)
 {
     StopWatch watch = new AutoStopWatch();
     do
     {
         if ((((bool) block.Run())))
         {
             return true;
         }
         Sleep(millisecondsBetweenRetries);
     } while (watch.Peek() < millisecondsTimeout);
     return false;
 }
Example #4
0
        public static bool Retry(long millisecondsTimeout, int millisecondsBetweenRetries
                                 , IClosure4 block)
        {
            StopWatch watch = new AutoStopWatch();

            do
            {
                if ((((bool)block.Run())))
                {
                    return(true);
                }
                Sleep(millisecondsBetweenRetries);
            }while (watch.Peek() < millisecondsTimeout);
            return(false);
        }
		public virtual void TestLoopWithTimeoutReturnsWhenBlockIsFalse()
		{
			StopWatch watch = new AutoStopWatch();
			Runtime4.Retry(500, new _IClosure4_14());
			Assert.IsSmaller(500, watch.Peek());
		}