I just switched to Moq and have run into a problem. I\'m testing a method that creates a new instance of a business object, sets the properties of the object from user inpu
I have encountered similar issue. Bit I got the solution by using the latest Moq and passing the value like
var instance = new Bar(); Mock.Setup(foo => foo.Submit(ref instance)).Returns(true);
Earlier as well, I was using the same method, but i was not getting return as true.
Inside the actual function instance was getting created and overwriting the instance passed from the unit test class was causing the issue. I removed instance creation inside the actual class and then it worked.
Hope it will help you.
thanks