-
-
Couldn't load subscription status.
- Fork 56
Creating source generator #140
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Using lots of hard coded values for now
Still need to handle naming collisions VB support? TODO: Multiple constructors
Disable VB generation
Keboo
commented
Apr 22, 2022
|
@adamhewitt627 this is ready for review |
adamhewitt627
approved these changes
Apr 25, 2022
1 task
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This generator can generate argument null tests. These tests are often low value for developers to write, but not writing them can have a negative impact on projects where code coverage is measured. This is a compromise allowing AM to generate the tests out and let developers focus on writing higher value tests.
The trigger for this generator is a new
ConstructorTestsAttribute. When this is placed on a class, the generator will generate out a partial class with tests for the constructors.Sample showing the generated partial class that was generated for the xUnit project here:
Outstanding
work andquestions:Needs to be appropriately packaged into the NuGet packageNeeds tests around failure casesWhat happens if the class is not declared partial?What happens if the TargetType is not specified on the attribute?What happens if constructor arguments are simple value types (int,string,struct, etc)?ArgumentNullExceptionand rethrowing if the parameter name was wrong. Because these methods would not be decorated with any attributes it would be up to the develop to appropriately invoke them (perhaps providing a helper method to invoke all of the generated methods?). Would this be a valuable addition?