Actually this happens when one of your mocked objects is mocking a method that returns something and your mocking doesn't return anything. Eeeeh - that was quite tricky. Got it?
Here is an example:
When I mock this method:
by using the following code to do the mockPublic Class FacadeObject Function CreateSomeThing(ByVal aName As String) As Long End Function End Class
Expect.Once.On(m_mockadFacadeObject).Method("CreateSomeThing")
an exception of RemotingException (ByRef value type parameter cannot be null) will be thrown.Here is another description that you might find easier to understand
6 comments:
I guess you used the version from nmock.org, which is not maintained anymore.
Please try the version at http://sourceforge.net/projects/nmock2
Then you get an error stating that you have to set a return value.
happy mocking
Urs
Thank you Urs!
I must confess that it was quite sloppy of me not to set a return value but with your new update that will be even easier to remember.
I really apprieate the feedback also.
Keep up the good work.
Thank you very much for this post. I kept on looking at the parameter value....your post helped me fix the problem.
Hey - happy to help!
Even with this old post :)
I've never seen the benefit of writing gibberish in an effort to teach anything to anyone. They came to your page looking for answers to something they don't understand. How does adding confusion help?
@Richard.
Thank you for your kind reminder. I haven't looked through my posts (ca 800 of them) and check the jibberish level on each one.
This 3 year old one had slipped. Quite honestly I cannot remember what/how I wrote it.
I'll update it now.
Still.... 2 other people found it useful and the NMock team came back and helped me. So i wasn't a complete vast, don't you agree.
Again - thank you for the pointer for me to clean up some bad writing.
Post a Comment