Everything i read about unit testing mentions TypeMock isolator. thats good when you can control what unit testing and mocking tools you are using in the project but I am unable to use TypeMock. Instead the project uses Moq.

I cant however find a good resource for examples on Moq with sealed classes which lets face it SharePoint 2010 is full of!

Does anyone have any samples?

1 Answer 1


Simply put you cannot use Moq to mock behaviour of sealed classes or at least not easily. Microsoft Research have released a free mocking framework for this purpose called Moles which is available to download from http://research.microsoft.com/en-us/projects/moles/

Let us know if this is what you're looking for and we can provide further advice and samples.

  • its not ideal as I cant use moles in my project but thanks :-)
    – Mauro
    Commented Jun 14, 2011 at 15:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.