The Fakes Framework in Visual Studio 2012 is the next generation of Moles & Stubs. (opens in new tab) 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.
Moles allows to replace any .NET method with a delegate. Moles supports static or non-virtual methods. Moles works well with Pex.
Replace any .NET method with your own delegate! Watch the video (5min)! (opens in new tab)
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 (opens in new tab).
Download Moles (opens in new tab)! (free) Read more documentation (opens in new tab) or Follow us on Facebook (opens in new tab).
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).
人员
Peli de Halleux
Principal Research Software Engineer