-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Architecture rule validation: expect passes #189
Comments
@simonthum , since I had a very similar issue once, I think the idea is great. ArchUnit for Java has a very similar feature: However, there are use-cases, where an empty Input-set is needed (see: TNG/ArchUnit#816). I do not see an issue though to find a similar solution for the issue. Do you have a proposal for the Syntax? |
Sorry for the late response! I'd suggest either the syntax implied above as the new default:
or something like
with a missing AllowEmpty() call defaulting to check against emptiness. |
I have a simple thing running now, based on a modified Should(bool allowEmptiness). As expected, it makes a bunch of tests fail (about 30). This particular rule highlights the missing improvements:
To handle this as one would expect the check needs to be deferred and be made conditional. The current approach requires the user to modify the rule:
The question is how to proceed. Do you consider that state of affairs acceptable or should I try to defer? |
I put in some more effort to defer evaluation. Exist/NotExist seems fine now. It no longer checks for empty input, but for positive results, which should be mostly identical and avoids clashes with the internal Empty() logic required for Not/Exists. |
Hi,
I would like to ask about a rule validation feature I came up with.
Most of my rules are written so that they validate types. However I managed to write some that did not fail on my architecture because they did not match any type before checks ran, due to a typo.
I can identify this using
...Should().Exist().AndShould()...
, but preferred to write my own check routine to avoid repeating that clause.In fact I think this should be the default checking behaviour and implemented it for XUnit:
The effect is similar to
...Should().Exist().AndShould()...
early in the rule, but is on by default.That way it is a breaking change, but I think the added validation is worth it. What do people think?
I'd write the code for all Unit Test frameworks if consensus is reached.
The text was updated successfully, but these errors were encountered: