Search code examples
.netrhino-mocks

Stub return value for all inputs in Rhino Mocks


I am stubbing the return value of a method using rhino mocks. However, I want to return the same dummy value for any argument that is passed in.

How do I do this without pre-registering every input to return the same output?


Solution

  • _testHelper is helper class where you are returning a dummy value from GetMethodValue(). you have to write GetMethodValue() in your _testHelper class.

    SetupResult.For(_Repository.MethodName(null)).IgnoreArguments().Return(_testHelper.GetMethodNameResultValue());