public void Check(IProbe probe) { var timeout = new Timeout(_timeoutMillis); while (!probe.IsSatisfied()) { if (timeout.HasTimedOut()) { throw new AssertErrorException(DescribeFailureOf(probe)); } Thread.Sleep(_pollDelayMillis); probe.SampleAsync(); } }
public async Task CheckAsync(IProbe probe) { var timeout = new Timeout(_timeoutMillis); while (!probe.IsSatisfied()) { if (timeout.HasTimedOut()) { throw new AssertErrorException(DescribeFailureOf(probe)); } await Task.Delay(_pollDelayMillis); await probe.SampleAsync(); } }