This is a migrated thread and some comments may be shown as answers.

private method with out args

3 Answers 144 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Maha
Top achievements
Rank 1
Maha asked on 05 Dec 2012, 04:05 PM
Hello Telerik Team
I use Just Mock  and i want to mock a private method with 2 out arguments
how to achieve it
for example

private void myMethod(string x, string y, out bool isFound, out string result)

3 Answers, 1 is accepted

Sort by
0
Ricky
Telerik team
answered on 06 Dec 2012, 10:26 PM
Hi Maha,

Thanks again for contacting us.

Unfortunately, we don't support mocking of out/ref arguments for non-public method. However, we are working on this and planning to include it in one of our recent builds.
   

Kind Regards
Ricky
the Telerik team

Share what you think about JustTrace & JustMock with us, so we can become even better! You can use the built-in feedback tool inside JustTrace, our forums, or our JustTrace or JustMock portals.
0
Arthur
Top achievements
Rank 1
answered on 06 May 2015, 09:01 PM

Wanted to find out if mocking a private method with ref/out params is now possible with JM?  

 

Thanks!

 --Arthur

0
Stefan
Telerik team
answered on 07 May 2015, 11:33 AM
Hello Arthur,

Yes, it is possible and has been for quite some time now, using the Mock.NonPublic API.

Say you have a ref/out argument of type int. You can use ArgExpr.Ref(ArgExpr.IsAny<int>()) if you want to match the incoming value, or ArgExpr.Out(123), if you want calls to the arranged method to set the ref/out parameter to 123 on exit.

Regards,
Stefan
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
Tags
General Discussions
Asked by
Maha
Top achievements
Rank 1
Answers by
Ricky
Telerik team
Arthur
Top achievements
Rank 1
Stefan
Telerik team
Share this question
or