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 <T> GetAsync <T>(IProbe <T> probe) where T : class { var timeout = new Timeout(_timeoutMillis); T sample = null; while (!probe.IsSatisfied(sample)) { if (timeout.HasTimedOut()) { throw new AssertErrorException(DescribeFailureOf(probe)); } Thread.Sleep(_pollDelayMillis); sample = await probe.GetSampleAsync(); } return(sample); }