testing domain-model in DDD (subclass vs. interface-impl)
posted 8 years ago
in DDD you structure your design and code closely to the problem business area, which i think great. after reading some stuff about DDD something stay a bit unclear to me. respective papers never mentioned introducing interfaces for each domain model-element.
this way you can only inject dependencies by subclassing the production class and not passing an implementation of the interface, which i think "more natural" if i unit test.
example (passing by interface-impl, i usually prefer):
following would be more common from the stuff i read, where interfaces are hardly used, most likely because of the danger of having parallel hierachies everywhere -> each model-type has an interface type:
what kind of injection strategy do you follow when working with domain-models? the interface-impl or the subclass passing one?