对几种注入类型之一断言方法调用

发布于 2024-09-07 12:04:18 字数 141 浏览 3 评论 0原文

我们使用RhinoMocks。我有一个类型,其构造函数中注入了 9 个类型。我想要一种自动模拟类型的方法,但能够检测其中一个注入对象的特定方法调用(即我只关心其中一个注入对象的单个方法调用)。

这是可能的,还是我必须手动将所有模拟对象注入到构造函数中?

We use RhinoMocks. I have a type into whose constructor 9 types are injected. I'd like a way of automocking the type, but being able to detect a particular method invocation on one of the injected objects (i.e. I only care about a single method invocation on one of the injected objects).

Is this possible, or do I have to manually inject all the mock objects into the constructor?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

慵挽 2024-09-14 12:04:18

我还没有看到任何框架可以为您自动创建这些模拟。您可以在 [SetUp] 方法中执行此操作,因此至少测试不会因样板代码而混乱。

I haven't seen any frameworks that would auto-create these mocks for you. You can do it in your [SetUp] method, so at least the tests will not be cluttered with boilerplate code.

独闯女儿国 2024-09-14 12:04:18

我需要查看 http://autofixture.codeplex.com/。它并不是真正特定于容器的,有一个犀牛模拟的扩展。免责声明:我还没有尝试过自动固定装置。

I need to check out http://autofixture.codeplex.com/. Its not really container specific, there is an extension for rhino mocks. Disclaimer: I haven't tried autofixture yet.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文