Testability
To simplify testing, you should never instantiate an async worker directly, but inject an IAsyncWorker
.
In production code you can inject a real AsyncWorker
. In test code you can inject a fake object that executes the delegates synchronously.
Thus simplifying testing because no multi.threading handling is necessary.