views:

517

answers:

2

I'm new to RhinoMock's just been doing state unit testing up till now.

How do you test void functions?

Getting the following complie error when setting up expectation,

Expression does not produce a value

Basically I want to test that a certain mock's method is called a certain amount of times.

Cheers

+2  A: 

You want to use LastCall.

http://ayende.com/projects/rhino-mocks/api/files/LastCall-cs.html

Joseph Anderson
A: 

Better yet, you can use the Expect.Call method with a lambda:

Expect.Call(() => someVoidFunction());
Judah Himango
Unfortunately this project is pre 3.5.I will try this out in other projects though cheers
c00ke