valit-stack/Valit

Dont call .Satisfies() condition when .When() returns false

aletc1 opened this issue · 1 comments

In this code snippet:

.Ensure(m => m.Prop, o => o                   
   .Satisfies(prop => condition1)
   .When(x => condition2)

In the current version, condition1 and condition2 gets evaluated. But wouldnt be better to not evaluate condition1 if condition2 fails (returns false)?

Expected result: condition1 doesnt get evaluated if condition2 evaluates to false

Thank you

Good point! I'll look at that.