Sohan's Blog

Living the Developer's Life

Should You Unit Test Interaction With Static Methods?

No. You should not. Here’s an example:

If you are somehow mocking this static method, you are potentially making it dangerous for other places where this static method is used. Eventually, this will create red test results that are hard to find and make your tests dependent on each other.