|
From: Steve F. <st...@m3...> - 2004-07-07 11:57:23
|
There already is a mechanism to support this. Mocks as implemented have two functions, to check expectations and to stub return behaviour. What you're describing here is a stub which, if I remember correctly, is set up with SetupAndReturn() -- or something like that. The Setup methods will respond if asked, but are not included in the Verify(). There was a bug on the implementation for a while, but I hope that's fixed by now. S Thorne Nigel, Melbourne wrote: > I was writing a simple Wiki. > > To test a method on the wiki object I needed the wiki object to be in a > specific state (ie have a certain page loaded) > > The Wiki was talking to a mock PageRepository. > > To initalise the wiki ready for the test I had to tell the wiki to load > a page, and provide the mock PageRepository with the page to pass back. > This required me to set up an expectation. > > Notice, none of this was actually the focus of the test. > > In the test I then wanted to perform some action and then call verify to > see if the PageRepository etc was used correctly. > > It would have been nice, once I had the Wiki in the state I required, to > be able to clear all expectations so that the only expectations being > tested by the verify method were the ones related to the method under > test, not the setup code. |