Tuesday, September 3, 2019

NSubstitute Roslyn Analyzers

Quick tip if you are using NSubstitute (like me) as your mocking library. Certainly don’t forget to include the NSubstitute Roslyn analyzers as well.

This allows you to detect some cases where NSubstitute will fail at runtime (e.g. when you attempt to mock non-virtual members).

For the full list of rules that are validated, take a look at the documentation: