Moles allows to replace any .NET method with a delegate. Moles supports static or non-virtual methods. Moles works well with Pex.
The Fakes Framework in Visual Studio 2012 is the next generation of Moles & Stubs. Fakes is different from Moles, however, so moving from Moles to Fakes will require some modifications to your code. The Moles framework will not be supported in Visual Studio 2012.
Replace any .NET method with your own delegate! Watch the video (5min)!
Moles is a lightweight framework for test stubs and detours in .NET that is based on delegates. Moles may be used to detour any .NET method, including non-virtual/static methods in sealed types. Moles is freely available on Visual Studio Gallery or bundled with Pex.
Download Moles! (free) Read more documentation or Follow us on Facebook.
Troubleshooting in .NET 4.5
If you install the .NET Framework 4.5 on a machine, Moles will encounter issues when trying to compile.
The main issue happens when Moles tries to generate stubs or moles for types that exist only in .NET 4.5. Currently, the only workaround is to use filters in the .moles file to avoid loading those types (and dependent types if needed).