13 Jan 2006 22:18
RE: error mocking a method with string array as argument
Adam Dymitruk <adam <at> dymitruk.com>
2006-01-13 21:18:52 GMT
2006-01-13 21:18:52 GMT
What aspect of NMock is magical? > -----Original Message----- > From: testdrivendevelopment <at> yahoogroups.com > [mailto:testdrivendevelopment <at> yahoogroups.com] On Behalf Of Shmarya > Rubenstein > Sent: January 3, 2006 4:58 AM > To: testdrivendevelopment <at> yahoogroups.com > Subject: Re: [TDD] error mocking a method with string array as argument > > I think there is an important lesson in here somewhere about using mock > libraries. > > I personally prefer to write 'real' mocks rather than rely on 'magic' > libraries like NMock. While mocking tools like NMock certainly have a > place, > they are not always applicable. > > On 1/3/06, mnj_resultmaker <mnj <at> resultmaker.com> wrote: > > > > Well, I did that, but I would prefer to have my unit tests be more > > consistent. Also, my mock, which was coded in something like 3 min, > > does not expose the same kind of functionality that an NMock mock > > does. > > > > But you're right that this problem is not a show stopper, it's just > > really annoying. > > > > Martin > > > > --- In testdrivendevelopment <at> yahoogroups.com, Brian Button > > <bbutton <at> a...> wrote: > > > > > > Martin Nørskov Jensen wrote: > > > > Hi > > > > > > > > I'm using NMock for my unit tests, and I've just spent the good > > part of an afternoon being baffled about why my mocks could not > > recognize the method I was trying to invoke. > > > > > > > > After a while I figured out that it only failed when one of the > > method parameters was a string array (I haven't tried other types of > > arrays) so here is my theory: The ExpectAndReturn method accepts an > > object[] as the arguments to the method call. This has the keyword > > params so I can just write them one by one. But when I pass a string > > [] the method thinks I'm trying to pass each string as a separate > > argument to the method. Therefore it cannot find the method, because > > it looks for a different signature. > > > > > > > > Has anybody had any experience regarding this? I've made a mock > > class for now, but would prefer to use NMock, so any solutions to > > this problem are very welcome. > > > > > > Not to be flip or anything, but the pragmatist in me is wondering > > if you > > > could have just written your own custom, simple mock (or whatever > > you > > > want to call it) and had your test working long ago instead of > > chasing > > > down this problem for however long... > > > > > > Could that be a way out of this dilemma? > > > > > > bab > > > > > > -- > > > Brian Button bbutton <at> a... > > > Principal Consultant http://www.agilesolutionsgroup.com > > > Agile Solutions Group http://oneagilecoder.agilestl.com > > > St. Louis, MO (o)314.766.4694 (c)636.399.3146 > > > > > > Extreme Programming in St Louis - > > http://groups.yahoo.com/group/xpstl > > > > > > > > > > > > > > > ------------------------------ > > YAHOO! GROUPS LINKS > > > > > > - Visit your group > "testdrivendevelopment<http://groups.yahoo.com/group/testdrivendevelopment > >" > > on the web. > > > > - To unsubscribe from this group, send an email to: > > testdrivendevelopment- > unsubscribe <at> yahoogroups.com<testdrivendevelopment- > unsubscribe <at> yahoogroups.com?subject=Unsubscribe> > > > > - Your use of Yahoo! Groups is subject to the Yahoo! Terms of > > Service <http://docs.yahoo.com/info/terms/>. > > > > > > ------------------------------ > > > > > > -- > Shmarya > ----------------------------------------------------------- > shmarya.rubenstein <at> gmail.com - http://idp.satr-it.com > > > [Non-text portions of this message have been removed] > > > > > Yahoo! Groups Links > > > > > > Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/testdrivendevelopment/ <*> To unsubscribe from this group, send an email to: testdrivendevelopment-unsubscribe <at> yahoogroups.com <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
RSS Feed