这是我想做的事情:
_service.Stub(s => s.Method(Arg<Dto>.Is.Anything)).Return(new OtherDto { Parent = #My Arg# });
如何用Arg替换#My Arg#?如果有可能吗?
由于
答案 0 :(得分:3)
Func<Dto, OtherDto> returnOtherDto = dto => new OtherDto { Parent = dto };
_service
.Stub(s => s.Method(Arg<Dto>.Is.Anything))
.Do(returnOtherDto);