chevron-thin-right chevron-thin-left brand cancel-circle search youtube-icon google-plus-icon linkedin-icon facebook-icon twitter-icon toolbox download check linkedin phone twitter-old google-plus facebook profile-male chat calendar profile-male
0 votes
I'm trying to mock a function with an out parameter:

deleted


with this code:

deleted


I have verified the ... function is working, but I can't seem to get the ... thing to fire off

Am I missing something obvious?
asked by sorakiu (4.2k points)

4 Answers

0 votes
Hi,

I'm not sure that I understand the problem and I need more info so I can recreate\understand:
    1) Which version do you have?2) Which GetConfigObjectsByType() is not being called?3) How do you verify that your functions work or don't work? Do you use Verify.WasCalled..()or Assert?

Any additional relevant information is welcome.
answered by alex (18k points)
0 votes
1.) I had 6.2 but am encountering the same issue with 7.0.60
2.) I am unit testing the top function, the 3rd line is returning null instead of the object I want it to return
3.) the first thing (Isolate.NonPublic.WhenCalled(target, "deleted").WillReturn(deleted);) -- I verified by changing it to throw an exception -- I saw the exception.
The second thing (third line of the top function), I stepped through in the debug and I'm getting null instead of the object I told it to return
answered by sorakiu (4.2k points)
0 votes
Hi,

Unfortunately I still can't reproduce the case, and I need your additional help.
1) Try to use:
deleted
the .AndArgumentsMatch((t,i,b) => true) part doesn't realy do anything because the condition part of this statement is always true, so it's redundant.

2) In case it didn't help, will you be able to reproduce the problem with a small project and send it to us so we could examine it here.

Thanks for your cooperation.
answered by alex (18k points)
0 votes
Thanks! it worked -- I guess I just needed to take the parameters out of the () => thing.
answered by sorakiu (4.2k points)
...