|
From: Nick R. <nic...@fr...> - 2004-01-05 16:02:00
|
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. nick robinson site : http://www.fromconcept.co.uk weblog : http://www.fromconcept.co.uk/weblog.aspx |