سؤال

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