We use Windsor as our IoC container. Currently we use xml as the method by which components are registered. Having done both, I prefer the xml mapping to code registration because I can change something in the app on the fly if I need to. I know some of you out there will disagree with me on this but that's ok.
One of the annoyances with xml is that you have to type the namespaces and classes along with assembly names. We've found there is friction when we refactor our classes, changing names, moving classes, and adding namespaces in that Windsor bombs. When using the xml for configuration you don't get compile time checking, so a successful build may not mean working code, which in my opinion is bad.
We've simply added the following test to our unit-test project. It still doesn't fail when compiling, but fails instead when we run unit-tests, which is closer to compilation than run-time.
1: [Test]
2: public void Can_initiate_Windsor()
3: {
4: IWindsorContainer container = new WindsorContainer("windsor.config.xml");
5: }
That's it! It's very straight forward because all it's trying to do is start up windsor, the same way your application would, any exception that is thrown fails the tests, which causes the build to fail.
Remember Me
a@href@title, b, blockquote@cite, em, i, strike, strong, sub, super, u
This blog contains the thoughts and discoveries of Tim Barcz, a technologist with a interests in computer programming technologies.