|
From: Joe R. <joe...@gm...> - 2006-02-22 17:47:14
|
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 |