In my source generator repository I currently have code where I allow doing this for use in my tests, the issue is that I think being able to test any and all source generators with specific C# and Visual Basic language versions and global options should be something built into the source generator testing packages that I use.
It also would allow me to remove a bunch of my non-test code itself in order to properly set the project up for proper unit testing.
Internal types that would be added to both the CSharp and VisualBasic source generator test projects:
Type that can be added to the generic SourceGenerator test project that can be inherited from in the test classes in both the CSharp and VisualBasic source generator test projects:
The logical changes to both the test classes:
The files on my end that I could update to make use of the changed test classes after this change is accepted:
The way I simplify testing in my source generator repository:
Note: It might not use the GlobalOptions now, but that requirement may change in the future. Having it in out of the box in the testing assemblies my test project uses would be a huge benefit not only to my project, but other peoples projects that tests their source generators and need such functionality. The days where one must re-implement CSharpSourceGeneratorTest and VisualBasicSourceGeneratorTest to provide those abilities should be gone, replaced with being able to directly use the ones provided from this repository.
In my source generator repository I currently have code where I allow doing this for use in my tests, the issue is that I think being able to test any and all source generators with specific C# and Visual Basic language versions and global options should be something built into the source generator testing packages that I use.
It also would allow me to remove a bunch of my non-test code itself in order to properly set the project up for proper unit testing.
Internal types that would be added to both the CSharp and VisualBasic source generator test projects:
Type that can be added to the generic SourceGenerator test project that can be inherited from in the test classes in both the CSharp and VisualBasic source generator test projects:
The logical changes to both the test classes:
The files on my end that I could update to make use of the changed test classes after this change is accepted:
The way I simplify testing in my source generator repository:
Note: It might not use the GlobalOptions now, but that requirement may change in the future. Having it in out of the box in the testing assemblies my test project uses would be a huge benefit not only to my project, but other peoples projects that tests their source generators and need such functionality. The days where one must re-implement
CSharpSourceGeneratorTestandVisualBasicSourceGeneratorTestto provide those abilities should be gone, replaced with being able to directly use the ones provided from this repository.