Is static universally "evil" for unit testing and if so why does resharper recommend it?
- by Vaccano
I have found that there are only 3 ways to unit test (mock/stub) dependencies that are static in C#.NET:
Moles
TypeMock
JustMock
Given that two of these are not free and one has not hit release 1.0, mocking static stuff is not too easy.
Does that make static methods and such "evil" (in the unit testing sense)? And if so, why does resharper want me to make anything that can be static, static? (Assuming resharper is not also "evil".)
Clarification:
I am talking about the scenario when you want to unit test a method and that method calls a static method in a different unit/class. By most definitions of unit testing, if you just let the method under test call the static method in the other unit/class then you are not unit testing, you are integration testing. (Useful, but not a unit test.)