-
Heya, this isn't strictly related to MSTest so delete if you like, but GitHub doesn't give me any other ways to make contact. At the moment my source generator is fairly dumb, and relies on static methods using I noticed your MSTest one actually generates properties instead, and then inside My question is, in I'd like TUnit to do this so I can remove static classes/methods, but just don't know how to do it. Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
What we generate in the source generator is a list with 1 entrypoint, that is pointing to all the data in the rest of the files. It is split to different files so in ideal case we need to re-generate just one file, when editing tests instead of all the code. kinda like this: root => AllMyTests This one entrypoint (root) is then given directly to the test framework registration that is done via testApplicationBuilder. This registration is also source generated so you can change the name of the registering class (e.g. AllMyTests) and that way have more instances in process, rather than statics. I don't think this is strictly necessary though, we could also just provide different instances of the "list" populated with different data. |
Beta Was this translation helpful? Give feedback.
The source generator grabs all classes with the test class attribute, filters them to what we actually consider tests (e.g. non-private classes), and then uses this in 2 ways.
What connects them is a "naming convention", that both will generate entry for each class in the incoming list, and both will name it Nodes.