I'm about to take a decision about the mocking library for my next project.
and because I'm new to those libraries I made a quick search
I found that MOQ is much popular than NSubstitute and I expect more help from the community specially here at SO
But I liked NSubstitute syntax more, also it has a nice docs.
So my question is "Is there any thing that I can achieve using MOQ I cant achieve using NSubstitute?"
I am not aware of any limitation of nsubstitute
Few years ago I was an adept of moq, and now I have a preference for nsubstitute. I like the syntax (you call directly the method vs setup.), I think NSubstitute has the best syntax and is the most readable of all the frameworks (but this is a subjective assertion ^^).
Oh maybe one thing : NSubstitute don't have a strict mock mode (but I always thought it was a bad idea, so I never saw it as a limitation)
I noticed that when trying to mock a call to a method in NSubstitute by using .Do(), you can use the parameters only as an array of objects. In Moq you can force the number, types and names of parameters.
For example:
I found it easier to understand in Moq, as you can read more easily the parameters, rather than to have to count which one is it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With