An archive of the final state of NMock3
NMock3 builds on the work of NMock2. Specifically it adds lambda expressions to the matcher syntax. You can use lambda expressions instead of strings, making refactoring possible. The idea of Syntactic Sugar is maintained in that all expectations read like an English sentence.
#To get started with NMock3:
- Download the binaries from the Downloads page.
- Review the tutorials to see how NMock3 works.
- Check out the new Cheat Sheet.
- Check out the new API Docs.
- Provide feedback on this site.
The version titled 'NMock3 - RC1, .NET 4.0' on the download page is completely backward compatible. In fact, you can mix syntax within your unit tests.
Why is the namespace NMock2 and the assembly named NMock3 of the download titled 'NMock3 - RC1, .NET 4.0'?
Typically version numbers are discouraged from being included in namespaces. We decided not to perpetuate the practice of including the version number 3 in the namespace and left it at 2. This maintains backward compatibility with all existing tests. The newest RTM versions are just NMock.
The version number is read as Major.Minor.Build.Framework where "Framework" is the version of the .NET framework to which the assembly is compiled. 35 = .NET 3.5, 40 = .NET 4.0
Several reasons:
- NMock has a history of being very easy to read and understand. If it is easy to understand, developers are more likely to adopt it.
- NMock doesn't rely on the record/replay requirements as other mocking frameworks do.
- NMock can set up event binding expectations. (Other frameworks, such as Moq, couldn't do this at the time I looked at them)
- NMock is now using lambdas which support code refactoring and compile-time checking!