Ian Ringrose
Ian Ringrose

Reputation: 51897

Has nUnit got a mocking framework built in and should I use it?

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?

Upvotes: 3

Views: 954

Answers (2)

Michael Lloyd Lee mlk
Michael Lloyd Lee mlk

Reputation: 14661

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. :)

Upvotes: 2

Ian Ringrose
Ian Ringrose

Reputation: 51897

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.

Upvotes: 3

Related Questions