public InStateOrderingConstraint(IStatePredicate predicate) { this.predicate = predicate; }
public void WaitUntil(IStatePredicate predicate) { WaitUntil(predicate, Timeout.Infinite); }
public void WaitUntil(IStatePredicate predicate, Timeout timeout) { lock (sync) { for (; ; ) { if (firstException != null) throw firstException; if (predicate.IsActive()) break; if (timeout.HasTimedOut) { throw new TimeoutException(string.Format("timed out waiting for {0}", StringDescription.Describe(predicate))); } Monitor.Wait(sync, timeout.TimeRemaining); } } }
public IStateSyntax When(IStatePredicate predicate) { expectation.AddOrderingConstraint(new InStateOrderingConstraint(predicate)); return this; }