public void WhenSourceCompletes() { var f = sourceFuture.timeout(d, tc); f.value.shouldBeNone(); tc.timePassed = d - new Duration(1); f.value.shouldBeNone(); promise.complete(5); f.value.shouldBeSome(Either <Duration, int> .Right(5)); }
/* Waits at most `timeout` for the future to complete. */ public static Future <Either <Duration, A> > timeout <A>( this Future <A> future, Duration timeout, ITimeContext tc = null ) => future.timeout(timeout, () => timeout, tc);
/* Waits at most `timeoutSeconds` for the future to complete. Completes with * TimeoutException<A> on timeout. */ public static Future <Either <Duration, A> > timeout <A>( this Future <A> future, float timeoutSeconds ) => future.timeout(timeoutSeconds, () => new Duration(timeoutSeconds));