any method
Expects that the iterable contains at least on element such that
elementCondition
is satisfied.
Implementation
void any(Condition<T> elementCondition) {
context.expect(() {
final conditionDescription = describe(elementCondition);
assert(conditionDescription.isNotEmpty);
return [
'contains a value that:',
...conditionDescription,
];
}, (actual) {
if (actual.isEmpty) return Rejection(actual: ['an empty iterable']);
for (var e in actual) {
if (softCheck(e, elementCondition) == null) return null;
}
return Rejection(which: ['Contains no matching element']);
});
}