What about Moles?

by Larry Spencer Tuesday, April 3, 2012 5:27 PM

At my recent New England Code Camp presentation (Make Moq Rock), someone asked, "What about Moles?"

I have not used Moles, but from what I've read Moles does Moq one better. It can do what Moq does, plus it can add "detours" to any method or class -- even statics or sealed classes. It is available now for Visual Studio 2010, even without an MSDN subscription. It seems to be two products: one that behaves much like Moq (but less elegantly, I would argue -- lots of awkward naming conventions), and another that does the fancy stuff with detours. In Moles parlance, the Moq-ish aspect generates stubs, and the detours are the Moles.

However, as explained here, Moles is not being developed anymore but will emerge as a new product called Fakes in Visual Studio 2011. Furthermore, "Fakes is different from Moles ... so moving from Moles to Fakes will require some modifications to your code. A guide for this migration will be available at a later date."

In the meantime, you can read all about Fakes on MSDN.

Tags: , ,


Add comment

About the Author

Larry Spencer

Larry Spencer develops software with the Microsoft .NET Framework for ScerIS, a document-management company in Sudbury, MA.