DEV Community

Discussion on: Moq vs NSubstitute - Who is the winner?

Collapse
 
iamdorra profile image
Dorra BARTAGUIZ

Hello thanks for this post blog.
But I don't agree with some points.

To throw exceptions, I think that Nsubstitute is the winner because the syntaxe is
moq.Method().Throws();
instead of your suggestion

the example of Multi-returns is not the same, so we feel that the syntaxe of moq is better or equal to Nsubstitute one. But for the example :
mock.SetupSequence(x => x.Users)
.Returns(users1)
.Returns(users2)
.Returns(users3);
the best syntaxe of Nsubstitute would be
mock.Users.Returns(users1, users2, users3);
So for me Nsubstitute is better about multi-returns

Collapse
 
andreslozadamosto profile image
Andres Lozada Mosto

Hi Dorra, do you have good points here

Let me check about the Throws...

Regarding Multi-Returns, in my opinion Moq has a more readable syntax, but is only my opinion and I'm very glad to hear that you have your own point of view 🙂