示例#1
0
        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();
            }
        }
示例#2
0
        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);
        }