Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Integrate Pex with MoQ

Can anyone point me to a resource that shows an example of how Pex can be used in conjunction with MoQ? Thanks

like image 408
DotnetDude Avatar asked Jun 18 '10 15:06

DotnetDude


1 Answers

Pex uses Moles for isolation (mocking). One can still use MoQ alongside Moles. It's actually preferred to use a framework like MoQ for stubbing and mocking when the code can allow for it, leaving only Moles for the stuff MoQ can't isolate (sealed classes, non-virtual methods, private members, etc).

To backup my statements, Peli de Halleux (a member of the Pex and Moles project), mentions doing the same thing over on MSDN forums.

I have been using Moles and you can code with both frameworks in a unit test. But this probably isn't much help as you are asking specifically about Pex, which I haven't tried yet. Is it possible to modify the unit tests Pex creates and add the MoQ code after the fact?

like image 186
Matt Avatar answered Sep 18 '22 17:09

Matt