Does NSubstitute support the idea of ​​partial mocks?

+7
source share
3 answers

Yes! This feature was introduced in version 1.7.0 (released in January 2014).

http://nsubstitute.imtqy.com/help/partial-subs/

+3
source

Update: as @Brian points out, NSubstitute 1.7+ supports partial mocks

Original answer:

Not applicable to version 1.0.

This is what we are considering for vNext. If you have specific ideas or syntax requirements, send a message to the group. I added a problem for this in the problem log so that you can also add the details there.

+4
source

I am using version 1.3.0.0, but I could do:

Constraint failing = Substitute.For<Constraint>(); failing.Matches(-1).Returns(false); 

Where Constraint is a class with virtual methods, and the method call has been replaced just fine.

-3
source

All Articles