I try to divide my decisions into components with a clearly defined area of responsibility, such as a set of classes and other types working together to solve a particular problem. The classes that make up the public façade of such a component tend to benefit greatly from the availability of interfaces, as this allows me to easily replace or drown them for testing and general maintenance. Whether you are adding interfaces for internally used classes for unit testing purposes only, this decision is usually determined by internal complexity, and whether the component itself uses other components that need to be cut through.
Creating an interface for a class is actually quite simple, given that Visual Studio even has the necessary refactoring options built-in (right-click interface, refactor-> extract). Thus, the effort to create code to create the interface is somewhat trivial (assuming that the design is determined by how the class ends).
Despite the fact that over time, some efforts are associated with supporting interfaces, I most often use them. This reduces the open surface of the API, which simplifies maintenance, and if you have tools like R #, there is almost no extra effort.
It is also worth mentioning that TypeMock and Moles (Pex companion) connect to the profiling API. Thus, it is somewhat unlike AOP, although they provide AOP-like capabilities. They are useful when you need to intercept static methods or regular field calls, which you cannot model using interfaces.
source share