|
From: Steve F. <st...@m3...> - 2004-01-06 11:10:18
|
Your mileage may vary. My instincts are more "discpline and bondage" than some of the others, so I would have preferred to have Strict as the default setting, but others prefer a little slack. Don't forget, you can also check that a method is /not/ called, if that's what you're interested in. S. Nick Robinson wrote: > I am sure there is a really good reason for the Strict property being > defaulted to false, but what do people think about this defaulting to > true? Through human error, we have missed things when building the > mocks. I have been sat with a colleague today, and we expected the > abscence of a method call in the Expect calls, to result in a failure > when the method is actually called. So we looked at it and so the > Strict property, set it to true and ran. Hey presto, we found that > not only was the problem highlighted by setting this to true, but we > had overlooked a call to a certain method in a certain way. Setting > it to true picks this up, because it shows we didnt do a > Mock.ExpectXXX(). > > I can see that maybe having to put all calls in, would couple the > code to the behaviour of the class that uses the mock. But I think > thats what we are doing anyway, and it reads better by making the > mock behaviour more explicit in the test cases, by having to define > the calls. If strict is false, then ignore seems to be redundant? > > Just wondered what peoples thoughts are. |