Update unit tests for DI and remove unused code
Simplify the use of closures in DI