Geekus Con Livus

Malcolm Anderson's home for Geeks With Lives
posts - 63, comments - 51, trackbacks - 23

My Links

News

Archives

Post Categories

NMock and the Heisenberg uncertainty principle

Something interesting with NMock.

 

If you set an ExpectAndReturn block and then set a watch on that value, you could  will end up with a NMock.VerifyException.

 

Here's what's going on.  When you set the ExpectAndReturn, like this one

fooMock.ExpectAndReturn( “LoginEnabled“, true );

you are saying that you expect your mock to check the value of LoginEnabled one time.  If you want to use that value twice it would look like this:

 

fooMock.ExpectAndReturn( “LoginEnabled“, true );

fooMock.ExpectAndReturn( “LoginEnabled“, true );

 

pretty simple.

 

Now for the fun.  If you put a watch on while stepping through your code, you will bump that internal counter for EVERY STEP you take.  It doesn't seem to matter if you hit F10, or F11, each one counts.

Print | posted on Monday, August 01, 2005 9:42 PM | Filed Under [ Agile Development Stupid Code Tricks ]

Feedback

No comments posted yet.
Post A Comment
Title:
Name:
Email:
Website:
Comment:
Verification:
 

Powered by: