Shan04/05/2020, 12:01 AM
and switch to
inside. I would rather not constructor inject the IO Dispatcher inside every class that is implementing my abstract class, or do something like pass the IO Dispatcher as a parameter in all my public functions. Not sure if there is a way to mock this; open to suggestions! (Please!)
streetsofboston04/05/2020, 12:40 AM
to inject your own (test) dispatcher. I inject the dispatchers into my dependencies, but if you want to avoid that, you could create your own singleton in your code that uses the actual Dispatchers.Xxx per default but can be configured to return custom (test) dispatchers. This would be a bit error prone, though. Easy to forget and accidentally use the standard Dispatchers.Xxx instead....