Configuring Unity (2.x) to use Moq as an implementation via app.config
I am using Unity for IOC. I would like to customize the creation of moq objects using app.config. My config looks something like this:
<unity xmlns="schemas.microsoft.com/practices/2010/unity">
<container>
<register type="Namespace1.IFoo, FooInterface"
mapTo="Namespace2.FooImp, FooImplementation">
</register>
</container>
</unity>
I'm looking for a technique to specify a config like this:
<unity xmlns="schemas.microsoft.com/practices/2010/unity">
<container>
<register type="Namespace1.IFoo, FooInterface"
mapTo="Moq.Mock<IFoo>, Moq">
</register>
</container>
</unity>
I know I need to access the .Object property of the layout, but this example is only intended to explain what I want to do.
In other words: I don't want to use the code to set up unity for moq use. Of course, an option would be to create some helpers that can be used in general.
+3
source to share