Open grosch-intl opened 3 months ago
Of course it does not run the code generator, as it's not part of this compilation - you did not add it to the analyzers.
Running additional analyzers would be more likely and integration test, for a unit test I would rather add a snapshot of the generated code to the source of the compilation.
If I add a snapshot, then my tests aren't actually running against the generated attribute itself. If I update the attribute, and don't update the tests, then I won't catch things.
How would you do this as an integration test?
Add the code generator to your compilation like here:
First, thank you for this great library and the cookbook you wrote. It was incredibly helpful.
I created a code generator project and then added an analyzer to it. I'll eventually add a code fix as well.
The code generator provides an
AamDbProvider
attribute by creating Attribute.g.cs in theRegisterPostInitializationOutput
delegate. That is working fine. Now I want my analyzer to do some extra checks on the code. The test isn't "running" the code generator, and so I get an error saying that the type of namespace name 'AamDbProvider<>' can't be found. How do I handle that?This is what I'm doing in the test file: