Does NSubstitute support the idea of Partial Mocks?

我们两清 提交于 2019-12-07 00:08:52

问题


Does NSubstitute support the idea of Partial Mocks?

http://nsubstitute.github.com/

http://www.ayende.com/wiki/Rhino+Mocks+Partial+Mocks.ashx


回答1:


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

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




回答2:


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.




回答3:


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.



来源:https://stackoverflow.com/questions/4600825/does-nsubstitute-support-the-idea-of-partial-mocks

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!