I am writing the unit test using moq for a method which has a parameter passed by ref. I need to modify the value of that parameter after the method is called. I am trying using the Callback for Moq setup but it is not updating the value.
myMock = new Mock<IMyObject>();
Foo foo = null;
myMock.Setup(x => x.GetResult(It.IsAny<string>(), ref foo))
.Returns("SUCCESS")
.Callback(() => { foo = new Foo ();});
I seen similar question here but they are answered to use callback, but I get the value of foo as null always.