Action2<State, System, T1, T2, R> constructor
Action2<State, System, T1, T2, R> (})
Creates a new action command with 2 arbitraries.
Parameters:
description
: The description of the action.arbitrary1
: The arbitrary used to generate the first value.arbitrary2
: The arbitrary used to generate the second value.run
: A function to perform the action.precondition
: A function to test the precondition of the action.postcondition
: A function to test the postcondition of the action.
Implementation
Action2(
String description,
Arbitrary<T1> arbitrary1,
Arbitrary<T2> arbitrary2, {
required FutureOr<void> Function(State, T1, T2) nextState,
required FutureOr<R> Function(System, T1, T2) run,
FutureOr<bool> Function(State, T1, T2)? precondition,
FutureOr<bool> Function(State, T1, T2, R)? postcondition,
}) : super(
description,
combine2(arbitrary1, arbitrary2),
nextState: (s, args) => nextState(s, args.$1, args.$2),
run: (sys, args) => run(sys, args.$1, args.$2),
precondition: (s, args) =>
asyncCallOr(() => precondition?.call(s, args.$1, args.$2), true),
postcondition: (s, args, r) => asyncCallOr(
() => postcondition?.call(s, args.$1, args.$2, r),
true,
),
);