You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It is a lot simpler, since you do not need to define a separate class for just getting translated texts - and it is extremely versatile since you can put in as much logic as you'd like. I'll look into expanding it to support using the entity under test as a parameter, so you can go: .WithMessage(person => $"{person.Email} is not a valid email")
I think that it could be achieved in different fashion but the utility this solution provides is higher than the cost.
But I would go with convention where you provide a current property value first and then separate overload with value and "entity under test"/"model" as second parameter just as I suggested in #114. So it would go like this: .WithMessage(v => $"{v} is not a valid email") .WithMessage((endDate, m) => $"{endDate} predates {m.StartDate} for whatever reason, lol")
So the difference between your proposal and mine is to always have same argument at same position, no matter how many overloads.
E.g. for translation of the error messages depending on user's culture.
Basic usage would be something along the lines of
.WithMessage(()=> _translationService.GetError("Missing_Email"))
The text was updated successfully, but these errors were encountered: