4 ms·
This is the only answer that speaks to me. Although I would think most often you would have such dependencies be API calls over network. It would me more pruden
by DenisM 10y ago
This is the only answer that speaks to me. Although I would think most often you would have such dependencies be API calls over network. It would me more prudent in such case to create a mock server rather than use DI. But yeah, in general API from a third party might call for DI. Thanks.
- bbcbasic 10y ago> only answer that speaks to me So what if a dev home brews parser for instance, and you use that to read in files from a legacy system via ftp. You wouldn't test the parser code on its own? You test it all end to end?
- DenisM 10y agoIf it's just a parser you need to test, there is no need for DI - just give the parser some files to chew on, and test it directly. If the "parser" has built-in logic to orchestrate remote file retrieval over FTP then DI is warranted, as per the other part of my previous answer.