开发者

Does NSubstitute support the idea of Partial Mocks?

开发者 https://www.devze.com 2023-02-02 05:55 出处:网络
Does NSubstitute support the idea of Partial Mocks? http://nsubstitute.github.com/ http://www.ayende.com/wiki/Rhino+Mocks+Partial+Mocks.as开发者_如何转开发hxUpdate: As @Brian points out, NSubstitute

Does NSubstitute support the idea of Partial Mocks?

http://nsubstitute.github.com/

http://www.ayende.com/wiki/Rhino+Mocks+Partial+Mocks.as开发者_如何转开发hx


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

Original answer:

Not as of v1.0.

It is something we're considering for vNext. If you have specific syntax ideas or requirements please post to the user group. I've added an issue for this to the issue log, so you could also add details there.


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

http://nsubstitute.github.io/help/partial-subs/


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 was substituted just fine.

0

精彩评论

暂无评论...
验证码 换一张
取 消