Although it is not recommended to mock classes that have behaviour in the constructor sometimes it is necessary to do so. The reason that this is not recommended is because if the constructor invokes methods that are mocked then there is a circular dependency, i.e. the expectations can only be set once it has been constructed but it cannot be constructed until the expectations have been set.
This class forms part of the mechanism to support this. It basically acts as a proxy to which expectations can be added in order to allow the real object to be constructed at which point this proxy is not used.
|
|