Testing with Unity, Policy injection and solving “Ambiguous match found. (Strategy type Instance Interception Strategy” problem
March 16, 2010
I have been chasing this for quite some time now, about 4 days on and off. But now I have nailed it, thanks to Christer Cederborg – my Unity beacon in the dependency injection mist.
OK – the problem is as follows; I have an object factory that encapsulates the calls to Unity for registration and resolving. This is done because I want to control if the resolved objects should be wrapped with PolicyInjection or not.
However I ran into problem when I created test for my code. In the top most layer an resolved started to fail for the layers beneath them. I started to get an error which basically said:
Ambiguous match found. (Strategy type Instance Interception Strategy…
As often, I didn’t understand the error message and started to chase down the wrong things. I first thought that this had to do...