Creating a Stub That Redirects Input Parameter to Method Return Value
Posted 9 months ago on June 01, 2011
In the case where you want to create a stub that simply passes the input parameter through to it's return value, you can use this syntax in Moq:
mock.Setup(m => m.Method(DateTime.Now)).Returns((DateTime param) => param);
Documenting this here because I use it just often enough to forget.
Comments
New Comment