|
From: Joe R. <joe...@gm...> - 2006-02-22 18:28:37
|
I believe you can disregard this question. Since sending the email I've discovered that I can pass a Matcher to the "To" method in addition to a value. This seems to accomplish what I'm after. I was trying to do .To (value).Matching (myMatcher) which I now know to be incorrect. If there's a better way to do this, I'd still like to hear any advice. Thanks! -joe On 2/22/06, Joe Ross <joe...@gm...> wrote: > I've done all of the due diligence I could think of before asking this > question. It seems obvious and I found some references to it on a > JMock forum but nothing with regards to NMock. I did most of my > searching with regards to ArrayLists as I figured there would be more > posts about .NET 1.x than 2.x. > > So anyway, the question is: I have an interface that exposes a > property of type List<T>. I've worked my way through the NMock2 > source and discovered that when calling the setter, an > NMock2.Matchers.EqualMatcher is used to determine if the value passed > to the setter matches the expectation. EqualMatcher checks if it's an > array by using "is Array" (it is not technically an array) so then it > does an equals. At this point it's basically comparing the addresses > that each reference is pointing two. The addresses are different so > it fails. > > I need a more complex check than this for this collection. I thought > I could create a custom Matcher but it appears that the > ArgumentsMatcher is called before ExtraMatchersMatch. Is there a way > to override which ArgumentsMatcher is used? > > Again, I apologize if this question has been covered before. I > searched Google and this mailing list. I made my way through the > source code. I don't really know of a good source of NMock2 > documentation (I have that cheat sheet PDF which is nice) besides the > source code and tests. > > Thanks for any assistance to an NMock2 newcomer, > -joe > |