Jason
Jason

Reputation: 21

Microsoft Unity registration

We are using Unity for IOC in a large application with hundreds of dlls. We mostly use the xml configuration files, but I find that a lot of the time, we miss adding the dependencies to one of the files and only discover it after testing. Is there any tool or technique that can be run post check-in of the code to try to reduce the instances of this happening?

Upvotes: 2

Views: 133

Answers (1)

Mark Seemann
Mark Seemann

Reputation: 233367

To my knowledge, the only way to address that problem is to have a set of automated tests that attempt to use the application.

Some DI Containers come with a self-test, diagnostics feature, but all such a mechanism can tell you is whether or not the DI Container is internally consistent. It can't tell you if there are entire sub-graphs that your application may need, but are unknown to the container.

Although Integration Tests, Acceptance Tests, System Tests, etc. is the only mechanism I know of to verify that composition is done correctly, you should still keep the Test Pyramid in mind. Write enough high-level tests to capture container configuration issues, but no more.

You should also consider moving away from explicit (XML) configuration, and either towards convention-based configuration, or towards Pure DI.

Upvotes: 1

Related Questions