Skip to main content
7 events
when toggle format what by license comment
Aug 8, 2018 at 10:26 comment added Ewan @Flater urg, I just tried that but it makes the answer unwieldy and just goes off into a long discussion on various types of dependency. Yes, you are correct that for example Order, might be considered a dependency, but I think my example better demonstrates what I mean than a long explaination
Aug 8, 2018 at 10:20 comment added Flater @Ewan: I'm not saying you're wrong, but your answer might benefit from strictly defining what you mean by "dependency". Because what you say conflicts with the notion that public methods are inherently designed to be used externally and therefore are depended upon by external callers.
Aug 8, 2018 at 10:08 comment added Ewan @Flater I think its pretty clear which classes are designed to be dependencies and which are not. Obviously you could make the case that anything is potentially a dependency, but I think its possible to make sensible decisions
Aug 8, 2018 at 10:05 comment added Flater You only need Interfaces for classes which are used as dependencies But the inherent nature of public methods is so that others can use them, which inherently creates a dependency. Your answer only focuses on testing the business logic, but it's perfectly possible to test more than just the business logic, at which point you do need multiple interfaces. Secondly, it's possible to use dependency injection regardless of unit testing, which would still warrant using interfaces.
Aug 8, 2018 at 10:03 history edited Ewan CC BY-SA 4.0
deleted 4 characters in body
Aug 8, 2018 at 9:59 comment added Fabio Just to mention that mocking all dependencies will bite you later during refactoring, where adding/removing parameter in interface contracts will force you to make changes in the tests as well. Suggest to mock only dependencies which makes tests slow(database, external resources) or dependencies which require very complicated test case configuration.
Aug 8, 2018 at 9:48 history answered Ewan CC BY-SA 4.0