internal static ConfiguredCall Returns <T>(MatchArgs matchArgs, Func <CallInfo, T> returnThis, params Func <CallInfo, T>[] returnThese)
        {
            var     context = SubstitutionContext.Current;
            IReturn returnValue;

            if (returnThese == null || returnThese.Length == 0)
            {
                returnValue = new ReturnValueFromFunc <T>(returnThis);
            }
            else
            {
                returnValue = new ReturnMultipleFuncsValues <T>(new[] { returnThis }.Concat(returnThese).ToArray());
            }

            return(context.LastCallShouldReturn(returnValue, matchArgs));
        }
Beispiel #2
0
        private static ConfiguredCall ConfigureReturn <T>(MatchArgs matchArgs, Func <CallInfo, T> returnThis, Func <CallInfo, T>[] returnThese)
        {
            IReturn returnValue;

            if (returnThese == null || returnThese.Length == 0)
            {
                returnValue = new ReturnValueFromFunc <T>(returnThis);
            }
            else
            {
                returnValue = new ReturnMultipleFuncsValues <T>(new[] { returnThis }.Concat(returnThese).ToArray());
            }

            return(SubstitutionContext
                   .Current
                   .ThreadContext
                   .LastCallShouldReturn(returnValue, matchArgs));
        }