casesOfRole method
The cases of role: each of its providers, with every provider of
each role the provider requires that has several, and each subset of
the roles the role uses.
Implementation
List<ContractCase> casesOfRole(Role role) {
final used = [
for (final other in role.uses)
if (registry.providersOf(other).isNotEmpty) other,
];
return [
for (final provider in registry.providersOf(role))
for (final picks in _picksOf(
provider.descriptor.effectiveRequires.toList(),
))
for (final subset in _subsets(used))
_case(
_caseName(
'${role.id} by ${provider.descriptor.id}',
picks,
subset,
),
[provider.descriptor.id],
picks: {...picks, role: provider.descriptor.id},
present: subset,
),
];
}