|
From: Dominik F. <li...@ro...> - 2004-12-17 22:50:25
|
Hi Jim
Yes, the function should set new values to the refered array.
It would be nice if you could implement such a functionality in nmock. I
didn't know if i still work on this projject after the holidays, but if
yes, i'll be eager to test it :)
Dominik
Jim Arnold wrote:
> I understand now. You really want to set a result on the ref
> parameter. There's no reason why NMock couldn't be changed to allow
> this; I think it's a valid enhancement and I'd like to work on it.
> Maybe if I get some time over the holidays :-)
>
> Jim
>
> ThoughtWorks
> -----nmo...@li... wrote: -----
>
> To: Jim Arnold <JA...@th...>
> From: Dominik Fretz <li...@ro...>
> Sent by: nmo...@li...
> Date: 12/16/2004 11:02PM
> cc: nmo...@li...
> Subject: Re: [Nmock-general] Problem with 'ref string[]' parameter
>
> Hi Jim
>
> Thank you for your fast answer & bug fix!
>
> Probably my test is a bit too constructed to display the miss
> behaivior ...
>
> The concrete problem was in a existing project of mine.
> There is a given library with a more or less simple behavior, Its
> a database abstraction lib.
> There are structs for the rows of a table, and a function to fill
> a array of this structs for a select statement.
> The function, as example 'GetJobsForCustomer' looks like this:
> public bool GetJobsForCustomer(int customerId, ref JobRow[] rows)
>
> Call the function, i have to create a new, but null assinged
> JobRow array, and pass this by reference.
> If the function returned true, it successed, and my rows array
> contains all the JobsRow's for the customer.
>
> It tried to create a DynamicMock for this behavior ... but it
> seams that this is a bit out of the probabbilities
> of nmock. I think i have to implement a mock by myself.
>
> But thank you for fixing the bug so fast!
>
> and sorry for the 'mail-adress-mess', i posted the first massage
> over a webmail that was not successfully configured.
>
> Greethings
> Dominik
>
>
> Jim Arnold wrote:
>
>> Yes, there is a bug, but I'm a little confused by your
>> test. NMock will only verify the value of a parameter, not the
>> actual reference. In your test, you assign the variable
>> 'refStringArr' to null, then pass it to your mock. This will
>> fail (assuming the bug has been fixed) because NMock is expecting
>> the original value assigned to strArr, which was {"a", "b"}.
>> Even if NMock could have compared the reference refStringArr with
>> strArr, however, it still would have failed, because they are
>> different references. So I'm not sure what you expect the
>> behavior to be.
>> Anyway, I have fixed the bug, and it should make its way onto
>> SourceForge in the next day or so.
>> Jim
>> ThoughtWorks
>
>
>
> ------------------------------------------------------- SF email is
> sponsored by - The IT Product Guide Read honest & candid reviews on
> hundreds of IT Products from real users. Discover which products truly
> live up to the hype. Start reading now.
> http://productguide.itmanagersjournal.com/
> _______________________________________________ Nmock-general mailing
> list Nmo...@li...
> https://lists.sourceforge.net/lists/listinfo/nmock-general
|