Moq - How to mock a function call on a concrete object?

Posted by dferraro on Stack Overflow See other posts from Stack Overflow or by dferraro
Published on 2010-03-17T13:37:01Z Indexed on 2010/03/20 3:51 UTC
Read the original article Hit count: 389

Filed under:
|
|
|
|

Hello,

How can I do this in Moq?

Foo bar = new Foo();
Fake(bar.PrivateGetter).Return('whatever value')

It seems I can only find how to mock an object that was created via the framework. I want to mock just a single method/property on a concrete object I've created...

In TypeMock, I would just do Isolate.WhenCalled(bar.PrivateGetter).Returns('whatever value')..

Any ideas?

© Stack Overflow or respective owner

Related posts about moq

Related posts about mocking