c# - Moq - Setup with constraint? -


i'm trying stub this:

public t getcommand<t>() t : icommand, new() 

i'm using moq (c#), , code looks this:

_mockedbusinessfactory.setup(x => x.getcommand<icommand>()); 

but there question: how deal new() constraint?

any idea?

maybe this:

var stub = new mock<icommand>(); stub.setup( //... setup stub  mockedbusinessfactory.setup(x => x.getcommand<icommand>()).returns(stub.object); 

ps. i'm not moq user


Comments

Popular posts from this blog

yii2 - Yii 2 Running a Cron in the basic template -

asp.net - 'System.Web.HttpContext' does not contain a definition for 'GetOwinContext' Mystery -

mercurial graft feature, can it copy? -