What are NSubstitute limitations, specially vs MOQ?
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:
- NSubstitute: .Do(param => new ExObject{ s = (string) param[0], i = (int) param[1] })
- Moq: .Callback< string, int>((text, nb) => new ExObject{ s = text, i = nb })
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.