expectDecisions method
Verify the exact policy-decision sequence without depending on a matcher library.
Implementation
void expectDecisions(Iterable<CommandPolicyDecision> expected) {
final expectedValues = List<CommandPolicyDecision>.of(expected);
final actual = <CommandPolicyDecision>[
for (final event in _events) event.decision,
];
if (actual.length == expectedValues.length) {
var matches = true;
for (var index = 0; index < actual.length; index++) {
if (actual[index] != expectedValues[index]) {
matches = false;
break;
}
}
if (matches) return;
}
throw EffectCommandPolicyProbeExpectationException(
expected: expectedValues,
actual: actual,
);
}