Reputation: 3
A method in the service which I'm unit testing is calling a static method that is present in another service.
I'm new to unit testing and have no idea how to mock these kinda dependencies. Please suggest!
Upvotes: 0
Views: 686
Reputation: 956
There is already a thread here about this topic. In fact it is not possible to create a service facade (Mock) for static methods. My suggestion here is to refactor your code in that way that you make your class non static and create an interface for it. Than you can inject your dependency class in the normal system via IOC and in the unit test you can create a mock with frameworks like Moq or Rhinomocks.
Upvotes: 2