expectAsync1<T, A> function
Informs the framework that the given callback
of arity 1 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 one argument. See also expectAsync0, expectAsync2, expectAsync3, expectAsync4, expectAsync5, and expectAsync6 for callbacks with different arity.
Implementation
Func1<T, A> expectAsync1<T, A>(T Function(A) callback,
{int count = 1, int max = 0, String? id, String? reason}) =>
_ExpectedFunction<T>(callback, count, max, id: id, reason: reason).max1;