开发者

How to use the Arg<> matcher from the Stub() in the Return()?

开发者 https://www.devze.com 2023-03-12 03:41 出处:网络
Here\'s what i\'d like to do : _service.Stub(s => s.Method(Arg<Dto>.Is.Anything)开发者_如何学Python).Return(new OtherDto { Parent = #My Arg# });

Here's what i'd like to do :

_service.Stub(s => s.Method(Arg<Dto>.Is.Anything)开发者_如何学Python).Return(new OtherDto { Parent = #My Arg# });

How can i replace #My Arg# with the Arg ? If it is even possible ?

Thanks


Func<Dto, OtherDto> returnOtherDto = dto => new OtherDto { Parent = dto };
_service
    .Stub(s => s.Method(Arg<Dto>.Is.Anything))
    .Do(returnOtherDto);
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号