1

Closed

Specify optional constructor arguments if the mocked type is a class

description

It would be nice to have an overload in Foq's Mock<T> class for supplying optional constructor arguments if the mocked type is a class.

The need for the additional overload emerged by AutoFixture.AutoFoq, a forthcoming AutoFixture extension for Auto-mocking with Foq.

When the mocked type is a class, AutoFixture supplies auto-generated specimens by using the following overloads:

Currently, for
It would be very nice if a similar feature also exists in a future version of Foq.
Closed Jan 26, 2014 at 5:48 PM by ptrelford

comments

ptrelford wrote Jun 18, 2013 at 6:32 AM

Thanks, great idea.

I plan to overload the Create method to take optional constructor arguments. I'll try and put this in to the source on the train home tonight and it will be part of a Foq 1.0 release in the near future.

baxevanis wrote Jun 20, 2013 at 8:25 AM

Awesome!