1

What is the difference between NMock and NUnit? I have spent some time Googling this and have found explanations here:

http://blog.yeticode.co.uk/2009/05/nunit-and-nmock/ http://en.wikipedia.org/wiki/NMock http://en.wikipedia.org/wiki/NUnit

However, I am still not clear.

Also the following webpage says: "We now have tutorials!": http://nmock3.codeplex.com/. I cannot find these tutorials. Are there any up to date tutorials available? I found this tutorial: http://msdn.microsoft.com/en-us/magazine/cc163904.aspx. However, after adding the reference to NMOCK3 (using NMock;), I get a compiler error trying to create an instance of DynamicMock: "The type or namespace name DynamicMock could not be found".

I have purchased a book on the subject and it is due to be delivered in a few days.

w0051977
  • 13,017
  • 23
  • 108
  • 265
  • 1
    NUnit is a unit-testing framework. NMock is for creating mocks of objects. They're completely different (except that you would often use mock-objects in your unit tests). – RB. Mar 14 '13 at 14:18
  • @RB, thanks, do you know where I can find an up to date tutorial for NMock3? I want to gain some practical experience before my book arrives. – w0051977 Mar 14 '13 at 14:20
  • Can be answered if you find out what mocking is; http://stackoverflow.com/questions/2665812/what-is-mocking and you'll probably be better off with http://www.hibernatingrhinos.com/oss/rhino-mocks – Meirion Hughes Mar 14 '13 at 14:23
  • @w0051977 Sorry - I use [Moq](http://code.google.com/p/moq/) as it's simple and lovely. You could try that out instead - the concepts are (mostly) the same... – RB. Mar 14 '13 at 14:54

1 Answers1

1

NMock is a framework that facilitates the achievement of unit tests, they create simulations data based on interfaces. mock is copy of data based on proxy pattern

Sample : for testing a business layer, and avoid to access the database, to avoid network constraints that are not part of the test, you mock your class of data access.

NUnit is technical layer for performs tests. but with NMock you can complete theses hards cases

Aghilas Yakoub
  • 27,095
  • 4
  • 42
  • 47