C# 如何使用Arg<&燃气轮机;返回()中的存根()中的匹配器?

C# 如何使用Arg<&燃气轮机;返回()中的存根()中的匹配器?,c#,rhino-mocks,C#,Rhino Mocks,以下是我想做的: _service.Stub(s => s.Method(Arg<Dto>.Is.Anything)).Return(new OtherDto { Parent = #My Arg# }); \u service.Stub(s=>s.Method(Arg.Is.Anything)).Return(newotherdto{Parent=#My Arg}); 我如何用Arg替换“我的Arg”?如果可能的话 谢谢Func returnOtherDto=dto=>n

以下是我想做的:

_service.Stub(s => s.Method(Arg<Dto>.Is.Anything)).Return(new OtherDto { Parent = #My Arg# });
\u service.Stub(s=>s.Method(Arg.Is.Anything)).Return(newotherdto{Parent=#My Arg});
我如何用Arg替换“我的Arg”?如果可能的话

谢谢

Func returnOtherDto=dto=>newotherdto{Parent=dto};
_服务
.Stub(s=>s.Method(Arg.Is.Anything))
.Do(返回其他DTO);
Func returnOtherDto=dto=>newotherdto{Parent=dto};
_服务
.Stub(s=>s.Method(Arg.Is.Anything))
.Do(返回其他DTO);

这真的有效吗?不要抱怨对
返回的调用丢失了吗?这真的有效吗?不要抱怨对
返回的调用丢失了吗?
Func<Dto, OtherDto> returnOtherDto = dto => new OtherDto { Parent = dto };
_service
    .Stub(s => s.Method(Arg<Dto>.Is.Anything))
    .Do(returnOtherDto);