-
Notifications
You must be signed in to change notification settings - Fork 731
Make type assertions more robust #1550
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
Make type assertions more robust #1550
Conversation
|
Questions:
|
I love a clean history and encourage people to provide clean PRs (see also my blog post on this).
I think I have causes that. Saw the same change in a PR from @jnyrup. I'll take a look. |
|
I included a fix for the failing approval tests in #1552. |
|
I have a couple of points left:
|
Nah. Separate commits is clear enough. Will merge them as is.
What do you mean?
You mean to improve the failure messages? If it's going to affect a lot of tests (and thus files), I would keep that in a separate PR?
You could mention something like "Improved the failure messages if the library is not used correctly"?
If it involves a lot of changes, I recommend doing it in a separate commit or separate PR |
With type.Should().HaveMethod("NonExistentMethod", new[] { typeof(int), typeof(Type) })you get With type.Should().HaveExplicitMethod(interfaceType, "ImplicitMethod", new[] { typeof(int), typeof(Type) });you get instead of This is the only method related assertion that does not show the whole signature.
Currently only 2 files, TypeAssertions + Specs :) But it is also import to know if you think it is an improvement to change the order of the words. |
|
I think I'm done for know, other then await you review comments of course. For style/layout issues I started a discussion: #1555 For fixing argument issues in other types I will create separate PR's in the future (maybe a little smaller 😛) |
Knock yourself out ;-)
Same here ;-) |
|
Now with a lot of line breaks :) |
|
This one should be ready for review, @dennisdoomen @jnyrup. |
|
|
||
| [Fact] | ||
| public void When_an_unrelated_type_it_fails_with_a_useful_message() | ||
| public void When_an_unrelated_type_it_fails() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤔 This doesn't read very natural. Same for the other names.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although I agree, I only removed the with_a_useful_message part on existing tests.
I won't mind looking at better language in both test names and assertion messages of the existing 281 unit tests and 57 assertion methods, but I don't think we should add more to this PR 🏳️
I can't promise I kept as thorough as I was in the beginning. But next time, splitting this in separate PRs will make it more bearable. |
Yeah, I will do better next time :) |
|
Done reading, I have nothing to add. Feel free to delay the work about making assertions robust against being wrapped in an |
This remove some duplicate tests and shortens a lot of test names
* Standardize on because(args) and validation * No interpolation * Replace namespaces with wildcard * Reduce usage of wildcards * Less concatenation
Inspired by #1039
replace "to not exist" with "not to exist", both are valid but this feels more fluent to me, but maybe it is just taste.Status:
IMPORTANT
AcceptApiChanges.ps1/AcceptApiChanges.sh.