문제

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?

도움이 되었습니까?

해결책

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.

다른 팁

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top