Rhino Mocks - Arg.Ref 的正确使用
我在弄清楚 RhinoMocks 中 Arg 选项的正确参数时遇到问题。
我试图模拟具有 ref Int32 参数的 MSIRecordGetString 方法。目前我有:
_Api.RecordGetString(Arg<IntPtr>.Is.Anything,
Arg<Int32>.Is.Anything,
Arg<StringBuilder>.Is.Anything,
ref Arg<Int32>.Ref( ???, 0).Dummy);
谁能让我知道什么???应该/可以替换为。我知道它应该是 AbstractConstraint 类型,但我不确定什么是有效的。很难找到任何正确使用的示例。
干杯。
I'm having problems figuring out the proper arguments of the Arg option in RhinoMocks.
I am trying to mock the MSIRecordGetString method which has a ref Int32 parameter. Currently I have:
_Api.RecordGetString(Arg<IntPtr>.Is.Anything,
Arg<Int32>.Is.Anything,
Arg<StringBuilder>.Is.Anything,
ref Arg<Int32>.Ref( ???, 0).Dummy);
Can anyone let me know what ??? should/could be replaced with. I know it should be something of type AbstractConstraint but I'm not sure what is valid. Having difficulty finding any examples of proper usage.
Cheers.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我实际上习惯了起订量,但我对第一个参数的理解是一个约束,但鉴于您并不特别关心该值(我假设),您可以执行以下操作吗:
?
I'm actually used to Moq, but my understanding of that first argument is a constraint, but seeing as you don't particularly care for the value (I'm assuming), could you do the following:
?