Use a mock rather than thread count

Using live thread count isn't reliable as the number of live threads
may change for reasons outside the control of the test. Instead,
use mock Dispatchers and verify that their shutdown method has been
called.