expectAsync2< T, A, B> function
Informs the framework that the given callback
of arity 2 is expected to be
called count
number of times (by default 1).
Returns a wrapped function that should be used as a replacement of the original callback.
The test framework will wait for the callback to run the count
times
before it considers the current test to be complete.
max
can be used to specify an upper bound on the number of calls; if this
is exceeded the test will fail. If max
is 0
(the default), the callback
is expected to be called exactly count
times. If max
is -1
, the
callback is allowed to be called any number of times greater than count
.
Both id
and reason
are optional and provide extra information about the
callback when debugging. id
should be the name of the callback, while
reason
should be the reason the callback is expected to be called.
This method takes callbacks with two arguments. See also expectAsync0, expectAsync1, expectAsync3, expectAsync4, expectAsync5, and expectAsync6 for callbacks with different arity.
Implementation
Func2<T, A, B> expectAsync2<T, A, B>(T callback(A a, B b),
{int count = 1, int max = 0, String id, String reason}) {
if (Invoker.current == null) {
throw StateError("expectAsync2() may only be called within a test.");
}
return _ExpectedFunction<T>(callback, count, max, id: id, reason: reason)
.max2;
}