using System; using Rhino.Mocks.Interfaces; // ReSharper disable CheckNamespace namespace Rhino.Mocks // ReSharper restore CheckNamespace { public static class RhinoExtensions { public static IMethodOptions Return(this IMethodOptions self, Func func) { self.WhenCalled( invocation => { var arg0 = (TArg0) invocation.Arguments[0]; invocation.ReturnValue = func(arg0); }); return self; } public static IMethodOptions Return(this IMethodOptions self, Func func) { self.WhenCalled( invocation => { var arg0 = (TArg0) invocation.Arguments[0]; var arg1 = (TArg1) invocation.Arguments[1]; invocation.ReturnValue = func(arg0, arg1); }); return self; } public static IMethodOptions Return(this IMethodOptions self, Func func) { self.WhenCalled( invocation => { var arg0 = (TArg0) invocation.Arguments[0]; var arg1 = (TArg1) invocation.Arguments[1]; var arg2 = (TArg2) invocation.Arguments[2]; invocation.ReturnValue = func(arg0, arg1, arg2); }); return self; } public static IMethodOptions Return(this IMethodOptions self, Func func) { self.WhenCalled( invocation => { var arg0 = (TArg0) invocation.Arguments[0]; var arg1 = (TArg1) invocation.Arguments[1]; var arg2 = (TArg2) invocation.Arguments[2]; invocation.ReturnValue = func(arg0, arg1, arg2); }); return self; } } }