2 ms·
I don't see how you decided that DI requires some kind of special fixtures that are more complex than mocks. Mocks are generalized fixtures—just a reusable way
by aasasd 7y ago
I don't see how you decided that DI requires some kind of special fixtures that are more complex than mocks.
Mocks are generalized fixtures—just a reusable way to create them. And you can use them with DI. Only the method of delivery is changed, from an implicit backdoor to an explicit argument.
DI puts new requirements on production code and tests that aren't related to a specific mock, that much is true. At least if there's no automatic way to create ‘default’ dependencies.
- hinkley 7y agoThat was an empirical statement. Inasmuch as it was a value judgement, it was a condemnation of hand-rolling your own mocks. Which people seem to do with an alarming regularity, and with a fairly consistently appalling degree of skill. And not junior developers.