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
privatevoid myMethod(string x, string y, outbool isFound, outstring result)
3 Answers, 1 is accepted
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.
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.