DEV Community

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

Collapse
 
countingquoll profile image
countingquoll

I think you forgot another area of syntax where NSubstitute is the clear winner: when referencing the mocked object, e.g. when it is being injected.

var mockedRepo = new Mock<IRepository>();
var sut = new MyClass(mockedRepo.Object);

vs

var mockedRepo = Substitute.For<IRepository>();
var sut = new MyClass(mockedRepo);

Collapse
 
andreslozadamosto profile image
Andres Lozada Mosto

You are right!!
Next week I will update the post and mention you. Thanks!