-
Notifications
You must be signed in to change notification settings - Fork 112
Description
I have a method (function) that has two arguments and returns an integer. The first argument is passed by value and the second by reference (var). I would like to mock what this method should pass back on on the second argument. First, the closest thing I can see to accomplish this is to use WillExecute. However this only passes my method's arguments in as const. I am setting the result of my TExecuteFunc equal to args[0]. I would like to set args[1] equal to some value.
How to mock, or stub, a method that has one or more arguments that are passed by reference? I am wanting to test the argument that is passed by reference. The CUT has a method that that passes an argument by reference.
MockDap.Setup.WillExecute(function (const args : TArray<TValue>; const ReturnType : TRttiType) : TValue begin result := args[0]; args[1] := Expected; end).When.GetDAPData(TheLength, Actual);
Thanks