OrElseTogether()
SpecBase<TModel, TMetadata> OrElseTogether<TModel, TMetadata>(
this IEnumerable<SpecBase<TModel, TMetadata>> specs)
The OrElseTogether() extension method is used to combine a collection of specifications into a single specification
that is satisfied if any of the original specifications are satisfied. If the first specification is satisfied, the
remaining specifications are not evaluated. This means that any assertions or metadata that would be generated by the
remaining specifications are not generated.
IEnumerable<SpecBase<int>> specs =
[
new IsEvenProposition(),
new IsGreaterThanProposition(5)
];
var isEvenOrElseGreaterThanFive = specs.OrElseTogether();
isEvenOrElseGreaterThanFive.Evaluate(6).Reason; // "is even"
isEvenOrElseGreaterThanFive.Evaluate(3).Reason; // "is odd || is less than or equal to 5"