On Thu, May 5, 2011 at 11:18 AM, Giulio Petrucci <[email protected]> wrote: > Ok, there something I don't like: it seems like I'm testing the > List<T>.Contains() method. In fact using this approach (which is quite > black-box oriented) I cannot verify that at a certain point and under > some conditions the List<T>.Contains() method is called, even if I can > verify the effect of that call. Now, as I'm quite new to advanced > unit-testing I ask: is it just a problem of mine? ;-)
Personally, I don't like testing the implementation details. I've done it before in the past and it's caused me a lot of headaches (and broken tests) when I refactor the implementation, but don't change the behavior at all. If you really want to ensure that your list of blacklisted items is being used during the method call, create your own "BlackList" component with virtual methods that you can set expectations on. It will probably just be a thin wrapper around List<T>, but you'll be able to make sure that your BlackList is being consulted during the method call. --- Patrick Steele http://weblogs.asp.net/psteele -- You received this message because you are subscribed to the Google Groups "Rhino.Mocks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rhinomocks?hl=en.
