WHAT'S NEW?
Loading...

Unit test to validate services registered in your DI engine

Intro


Sometimes, when adding new functionality to your programs you might end up having errors difficult to track. This is the case when using DI and you missed to register one of your dependencies.


Solution


To avoid errors like the one defined in the intro I have created a unit test that checks that all services registered with the container are resolvable. You might find this helpful if you want to verify in the other endpoints that you've got all components for all services properly registered.

This particular case is using Castle Windsor as DI engine.


0 comments:

Post a Comment