문제

I recall that there is a mocking framework build into nUnit, but I can find details of it on the nUnit web site. Was I dreaming?

I was considering using it to save the pain of having to introduce another assembly that we will have to managed on all developer’s machines.

Are there any great dis-advantages to it as a mocking framework?

도움이 되었습니까?

해결책

What I have found:

nUnit mock is in its own dll (nunit.mocks.dll) so it not truly built into nUnit – this removes the reason I was looking at it.

From another question:

NUnit Mocks is very quaint as far as mocking goes. It doesn't support the currently preferred Arrange-Act-Assert syntax relying instead on Expect-Verify (record/replay). It also relies on strings to identify method and property names instead of lambdas. This makes it significantly resistant to refactoring. This is a serious problem. I would not recommend it.

So I think nUnit.mock is a none-starter for new code.

다른 팁

It seams to use strings rather than method calls. I'd avoid like the plague, string based mocking frameworks don't handle refactoring well (and generally suck). It is also not being updated.

introduce another assembly

Throw it in the version control. :)

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top