There are certainly many ways to stub out dependency, using constructor injection, etc etc. Here is one way to quickly stub out ServiceLocator rather than implementing ServiceLocatorStub. Lets say you have code that uses a helper and the dependency is not quite the responsibility of that object but its the sub object that uses it. […]
Tag: TDD
When doing unit testing, one always comes to a point where there this “kind of hard” part to test since the part depends on something you might not have control over or depends on the functionality of the dependency to complete. In “Working Effectively with Legacy Code” by Michael C. Feathers talks about a dependency […]