Has anyone tried this?
I like moq and i like what pex is doing, but haven’t tried them together. I’d prefer to use moq over moles in most cases I think but am curious to see if anyone has hit roadblocks?
Do they play nice?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Although I haven’t tried, Pex and Moq should get along like old friends.
While the interception techniques between Pex and Moq are different (Pex uses the ProfilerAPI to interpret MSIL instructions; Moq uses DynamicProxy to dynamically derive classes) there are references in the Moq source code that suggest it was designed to prevent re-entrance problems where Pex would interfere with Moq.
According to the original research paper for Pex, you can decorate your code with attributes that control when the Pex rewriter is used.
From the Moq source code:
PexProtector is defined as: