Fix unit-tests with proper stubs. Improve DI.