问题
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