Closed dominikjeske closed 4 years ago
I have a question about usage of library. Is it possible to do some condition before assert. for example I have code like this
if (!string.IsNullOrEmpty(currency)) { currency.MustMatch(_currencyRegex, (s, b) => throw new NumberOfCharsException(nameof(currency), 3)); }
so I would assert only when there is some value and skip when there is no value. Is there a way to do this with some one liner and library support?
Hey @bigdnf, No, Light.GuardClauses does not support this scenario out of the box. I would suggest that you write your own assertion if you need to support custom cases like this one.
I like fast response :)
I have a question about usage of library. Is it possible to do some condition before assert. for example I have code like this
so I would assert only when there is some value and skip when there is no value. Is there a way to do this with some one liner and library support?