I\'m trying to test some classes I\'ve made using mocks, but I\'ve seen all free mocking frameworks in c# aren\'t able to mock non-virtual methods (if it is not in an interf
According to the website it uses AOP to redirect calls:
Typemock Isolator uses aspect-oriented technology to redirect calls from the real code. This enables developers to define the behavior of the external component required for a tested scenario. For example, you can simulate that the disk is full when writing to a database by instructing Typemock Isolator to throw an OutOfDiskSpaceException when writing to the database. This is a scenario that will be nearly impossible to test without Typemock Isolator. The developer defines the behavior in the actual unit test and Typemock Isolator automatically isolates all required components.
This technique requires you to set up a special environment before you can run the test or use a VS plugin.
Some people think that the ability to mock everything makes Typemock too powerful, since you don't have to think so much about good design. A quote from Ayende:
The main weakness of Type Mock is its power, it allow me to take shortcuts that I don't want to take, I want to get a system with low coupling and high cohesion.
But of course since he is the creater of Rhino Mock he is not objective :)
I would think you are in for a great deal of work if you want to create a mocking framework with this functionality, so I would recommend to either purchase Typemock, or learn to code without it :)