lundi 23 février 2015

Can I access the full power of Autofac in UnitTests, using the Moq integration

My project (built on top of Orchard) uses Autofac. I am writing unit tests in which I want to stub out any dependencies using Moq, and I'm using the Autofac/Moq integration to achieve this.


This is fine for any simple dependencies that are being passed in as constructor arguments. (Autofac documentation provides details of how to achieve this here).


But because I don't ever have a containerBuilder, I don't see how to use a lot of Autofac's power - lamda registration, registering generics, marking properties to be auto-wired. etc.



  • Am I wrong and it is accessible somehow?

  • Is this stuff just not available due to some inherent constraint of the scenario?

  • Is it possible, just not implemented in this Autofac/Moq integration (yet)?

  • Is there a good work around?


Aucun commentaire:

Enregistrer un commentaire