Hi!
I wanna create a mock for my MySubClass. But, it has an argument ref in one of its methods.
The argument ref is an object of type MyReference. The object is created in another method, so I don't have control over the variable.
So, there is no way to do something like this, the mock doesn't work:
var sub = Substitute.For<MySubClass>();
MyReference reference;
sub.MyMethod(Arg.Any<int>(), ref reference).Returns(x => { x[0] = new MyReference(); return true; });
CallerClass caller =new CallerClass();
caller.CallMySubClass();
I need something this:
var sub = Substitute.For<MySubClass>();
MyReference reference;
sub.MyMethod(Arg.Any<int>(), ref Arg.Any<MyReference>()).Returns(x => { x[0] = new MyReference(); return true; });
Is there any way to use argument matchers (or another way) to solve it?