Geeks With Blogs

News
Geekus Con Livus Malcolm Anderson's home for Geeks With Lives

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.

Posted on Monday, August 1, 2005 9:42 PM Agile Development , Stupid Code Tricks | Back to top


Comments on this post: NMock and the Heisenberg uncertainty principle

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © Malcolm Anderson | Powered by: GeeksWithBlogs.net