1. Having to explicitly set
ServiceLocator.TheService = MyMock
in the setup and doing
ServiceLocator.ClearService
in teardown points to the fact the my tested code hasn't yet matured into having its own context (preferrably set via Dependency Injection)
2. When a repository holds state, something is really wrong (and it really hurts to refactor out that(ouch))
3. Don't use easy getters in your domain model objects that hide your repository gets, i.e. using
domainModelInstance.AnotherDomainModel
when that call does
return theOtherDomainRepository.findOtherInstanceById(this.otherId)
0 kommentarer:
Post a Comment