New answers tagged

1

The side effects would be implemented as events or messages being sent to a queue or injected interfaces being called. The test could instantiate the subject under test and subscribe to its events or provide the interfaces to the queues or the inserted objects. Then you can test if the events are triggered as expected or the expected messages are indeed ...


4

You should probably add Growing Object Oriented Software, Guided by Tests (Freeman and Pryce, 2009) to your bookshelf Does anyone have advice on a good approach for this problem? Basic idea: you want to choose a design such that the effects can be decoupled from your complicated logic. More specifically, you do that in such a way that the test can control ...


2

The realm of unit tests is in memory within a single process. What you have listed are integration points, they cannot themselves be unit tested. What you can do is push the actual integration code out into a collaborator class, and pull the orchestration/business logic in to a Unit Testable class. The collaborator isn't unit testable, but it is the smallest ...


Top 50 recent answers are included