Mock Interfaces & abstract classesInterfaces or Abstract classes allows Mock framework to be able to create stubs, A stub is a small block of code that is replacement of another component or code block. TDD approach of R-G-R (Red-Green-Refactor) is an example where a stub might be useful. In order to make a test successfull (Green), you would need a stub for places where actual definition is either not written or unknown.
Mock Everything in .NETAble to mock everything in a class, such as
- mock dependent objects
- non-virtual methods
- sealed classes
- static methods
- static classes
- non-public members
- non-public types
Mock Legacy CodeAssume some legacy code that has got some core business logic but has been designed/coded way before TDD has even started
- no interfaces
- no abstract classes
- has dependencies
Auto Recursive FakesOnce a mock is created some methods and properties will automatically return non null values such as interfaces, delegate, virtual class etc. This is also known as recursive mock.
Fake DependenciesIf a mock is dependent on another object, framework should allow to either populate or assign dependency so as to make the test succeed. Most of the frameworks will support it by default.
Unit Test IntegrationAllow easy integration with unit test tools such as NUnit, MSTest, Xunit etc.
Build Server IntegrationMock framework should allow you to be able to automate unit tests as part of your build & continuous integration. It should be able to support various build servers such as TFS, MSBuild, Nant, CruiseControl.NET etc
Code coverage IntegrationMock framework should allow to be integrated with 3rd party code coverage so as to produce various metrics that can easily point out areas of code that has not been covered by a unit test or has been wrongly written. It should be able to support various 3rd party code coverage software such as NCover, MSTest Code Coverage, ReSharper etc.
Intelligence is the ability to adapt to change.