Is it OK to use MS Fakes shims with NSubstitute mocks?

送分小仙女□ 提交于 2019-12-12 21:15:13

问题


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."

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

Should we expect any compatibility problems?


回答1:


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.




回答2:


Yes, you should be able to use Shims with mocking frameworks.



来源:https://stackoverflow.com/questions/12839158/is-it-ok-to-use-ms-fakes-shims-with-nsubstitute-mocks

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!