moq.analyzers
moq.analyzers copied to clipboard
Add analyzer for default `MockBehavior`
Many devs have strong opinions on MockBehavior.Strict
, MockBehavior.Loose
and the default behavior (Loose).
We should find a way to balance letting devs enforce the rules they want while not enforcing a particular opinion.
Designs to consider
-
An analyzer that flags when no behavior is specified or the default enum is used. This wouldn't enforce Loose vs Strict, just require people to use either Loose or Strict for clarity. I think this should be enabled by default as a warning.
-
A rule that requires Strict mocking. This would flag Loose, Default, or no specification. This should either be off by default, or on at Info level and devs can change the default using .editorconfig or a .global config file.