If you’re a fan of the Microsoft Moles framework you’ve probably heard that it’s being included in Visual Studio 2012 as Microsoft Fakes. As I was preparing my talk covering this isolation framework I noted some of the key differences between the two. Rather than going back and updating my original post regarding Moles (much of which is still applicable even with terminology changes) I thought I’d list those differences here. So without further ado:
- Assembly generation is driven by a .fakes file rather than a .moles file
- Isolation types are placed in a .Fakes assembly and .Fakes namespace
- Shim types replace Mole types
- Stub types are prefixed with “Stub”
- Shim types are prefixed with “Shim”
- ShimsContext replaces HostTypeAttribute for enabling profiling
- Profiling occurs in the IntelliTrace profiler rather than the Moles profiler
- Fakes allows shims for static constructors whereas Moles allowed erasing static constructors through an assembly attribute
- Fakes does not provide any support for finalizers whereas Moles allowed erasing finalizers through an assembly attribute
- Moles allowed controlling whether the profiler would run as a 32-bit or 64-bit process but this is now handled entirely by the IntelliTrace profiler
- The “classes” filter attribute was removed.
- Fakes supports isolating auto-implemented properties
- Fakes play much nicer with testing frameworks other than MSTest when run through Visual Studio