private static IReturnsThrows <TMock, TReturn> Returns <TMock, TReturn>(IReturns <TMock, TReturn> valueFunction, object action) where TMock : class { valueFunction.GetType() .InvokeMember("SetReturnDelegate", BindingFlags.InvokeMethod | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance, binder: null, valueFunction, new[] { action }); return((IReturnsThrows <TMock, TReturn>)valueFunction); }
private static IReturnsThrows <TMock, TReturn> Returns <TMock, TReturn>(IReturns <TMock, TReturn> valueFunction, object action) where TMock : class { valueFunction.GetType() .InvokeMember("SetCallbackWithArguments", BindingFlags.InvokeMethod | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance, (Binder)null, valueFunction, new[] { action }); return((IReturnsThrows <TMock, TReturn>)valueFunction); }