Automocking container with Moq
Posted by: eXtensible mind,
on 19 Nov 2008 |
View original | Bookmarked: 0 time(s)
I realized that I never blogged about this cool feature contributed by Slava to Moq-Contrib. Auto-mocking containers was an idea originally (IIRC) from the guys at Eleutian, later on picked up by Jeremy Miller with Rhino Mocks and StructureMap. The wiki document Slava put together on Automocking is a fantastic overview. Basically, you can have an (Autofac-powered) container create your objects under test with all its dependencies injected as mocks:var factory = new MockFactory(MockBehavior.Loose);var...