dotnet / roslyn-sdk

Roslyn-SDK templates and Syntax Visualizer
MIT License
498 stars 254 forks source link

Update Testing README to add best practice for caching ReferenceAssemblies #1160

Open MattKotsenas opened 3 weeks ago

MattKotsenas commented 3 weeks ago

Add a "best practice" and example of caching ReferenceAssemblies between tests. New users of the testing infrastructure often set the reference assemblies in a constructor, but don't use static or another method to share the instance between tests resulting in a lot of re-resolution and slow tests. As best I can tell this guidance isn't documented anywhere, but all the tests seem to do it.

MattKotsenas commented 2 weeks ago

@sharwell, this PR has some documentation changes that are also related to #1162.

Feel free to either take this PR as-is, or if you want the test framework stuff as part of your change I can rebase away that part and make this reference assembly specific.

Edit: I rebased away the XUnit stuff since that's already merged.