可以将MS Fakes垫片与NSubstitute模拟一起使用吗? [英] Is it OK to use MS Fakes shims with NSubstitute mocks?

查看:130
本文介绍了可以将MS Fakes垫片与NSubstitute模拟一起使用吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在使用 NSubstitute 来模拟用于单元测试的外部对象.但是,许多传统类不是通过接口调用的,因此无法轻松地用模拟代替.

We are using NSubstitute to mock external objects for our unit tests. However many legacy classes are not called via interfaces and can't be easily replaced with mocks.

我已经考虑使用问题的答案

I've considered to use Microsoft Fakes, but according to the answer for the question "Mock framework vs MS Fakes frameworks"

"(如果您已经在使用功能更全的模拟框架),则表示 可能感觉仿冒品中缺少一些重要的部分 存根."

" if you're already using a more full-featured mocking framework, you might feel like there are some important pieces missing from Fakes stubs."

是否可以在同一测试中将MS Fakes垫片与NSubstitute模拟一起使用?

Would it be possible to use MS Fakes shims with NSubstitute mocks in the same tests?

我们应该期待任何兼容性问题吗?

Should we expect any compatibility problems?

推荐答案

是.我已经将Shims和NSubstitute一起使用了几个月.它在本地和构建服务器上都可以正常工作.唯一的麻烦是Resharper测试运行程序无法与Shims一起使用,因此我们必须使用VisualStudio的测试运行程序.

Yes. I've been using Shims together with NSubstitute for several months. It work fine both locally and on build server. The only trouble is Resharper test runner does not work with Shims, so we have to use VisualStudio's test runner instead.

这篇关于可以将MS Fakes垫片与NSubstitute模拟一起使用吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆