Windsor 和 Rhino 的自动模拟容器
我想用 Windsor 进行自动模拟,这样我就可以做类似的事情
_controller = _autoMockingContainer.Create<MyControllerWithLoadsOfDepdencies>();
There was an Windsor auto mocking container in Ayende's< /一> <一href="http://blog.eleutian.com/CommentView,guid,762249da-e25a-4503-8f20-c6d59b1a69bc.aspx" rel="nofollow noreferrer">Rhino 库。但这似乎不再被维护,因此依赖项有点旧(它使用的是 Castle Windsor 2,但我们需要引用 2.5),因此导致 dll hell。
有没有可行的替代方案?我尝试从犀牛测试中提取相关的类,但我可以处理更多的内容。
I am want to do automocking with Windsor so that I can do something like
_controller = _autoMockingContainer.Create<MyControllerWithLoadsOfDepdencies>();
There used to be a Windsor auto mocking container in Ayende's Rhino libraries. But that doesn't seem to be maintained any more, so the dependencies are a bit old (it's using Castle Windsor 2, but we need 2.5 to be referenced), therefore causing dll hell.
Are there any viable alternatives? I tried pulling out the relevant classes from rhino testing, but it's much more involved that I can handle.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
感谢 @mookid8000 的链接和同事的帮助,我创建了这个......这似乎可以解决问题。
Thanks to @mookid8000's link and help from a colleague, I created this......which seems to do the trick.
了解如何使用 NSubstitute 将 Windsor 制作成自动模拟容器
通过注册一个使用 Rhino Mocks 而不是 NSubstitute 生成模拟实例的
ILazyComponentLoader
,用您想要的功能扩展 Windsor 应该相当容易。更新:我最近在我的博客上展示了 Windsor 如何使用 Rhino 模拟实现自动模拟。
Check out how Windsor can be made into an auto-mocking container using NSubstitute here.
It should be fairly easy to extend Windsor with your desired functionality by registering an
ILazyComponentLoader
that uses Rhino Mocks to generate mock instances instead of NSubstitute.Update: I recently showed how Windsor can implement auto-mocking with Rhino mocks on my blog.
Moq Contrib 有一个 Windsor + Moq 的自动模拟容器。似乎是最新的。显然,您必须使用 Moq 而不是 Rhino.Mocks。
Moq Contrib has an automocking container for Windsor + Moq. It seems to be up to date. Obviously, you'll have to use Moq instead of Rhino.Mocks.