seesharper / LightInject

An ultra lightweight IoC container
http://www.lightinject.net
MIT License
618 stars 121 forks source link

LightInject.xunit, composition #105

Open vegar opened 10 years ago

vegar commented 10 years ago

LightInject will look for an ICompositionRoot implementation in the same assembly as the requested service. [...] If such an implementation does not exists or that we for some other reason need to configure the container, we can do this by simply implementing a static method in the test class [...]

I seldom have my composition root in the same assembly as the service. I also wouldn't like to declare the Configure-method in every testclass. Wouldn't a ICompositionRoot in the test assembly be a better way of configure the container?

seesharper commented 10 years ago

Good idea. It could search for an ICompositionRoot implementation in the test assembly. If it is found, we execute it.