In order to aid type3 IoC and support mocking we either have to interface/impl separate everything, or have public empty constructors on real classes (that we want to mock). The empty ctor thing goes against the grain of a type3 migration. Talking to Jim Arnold in work today it appears that there is a simple way to add constructor support to NMock. In addition to ..

myMock.Instance // a property

.. we could have ..

myMock.getInstance("foo", "bar") // varargs method.

Whereas PicoContainer itself deals with instantiating multiple type-defined components, NMock only needs to deal with a single component. Jim says this is a much easier case, so lets hope we see it NMock soon.



Published

December 23rd, 2003
Reads:

Categories