Exemple #1
0
 public FuncExpectation <TReturn> Arrange <TReturn>(Type type, MethodInfo method, string localFunctionName, params object[] args)
 {
     return(ProfilerInterceptor.GuardInternal(() =>
     {
         MethodInfo localMethod = MockingUtil.GetLocalFunction(type, method, localFunctionName);
         return Mock.NonPublic.Arrange <TReturn>(type, localMethod, args);
     }));
 }
Exemple #2
0
 public ActionExpectation Arrange(object target, MethodInfo method, string localFunctionName, params object[] args)
 {
     return(ProfilerInterceptor.GuardInternal(() =>
     {
         MethodInfo localMethod = MockingUtil.GetLocalFunction(target, method, localFunctionName);
         return Mock.NonPublic.Arrange(target, localMethod, args);
     }));
 }
Exemple #3
0
 public object Call(object target, MethodInfo method, string localFunctionName, params object[] args)
 {
     return(ProfilerInterceptor.GuardInternal(() =>
     {
         Type type = target.GetType();
         MethodInfo localFunction = MockingUtil.GetLocalFunction(type, method, localFunctionName);
         return Mock.NonPublic.MakePrivateAccessor(target).CallMethod(localFunction, args);
     }));
 }
Exemple #4
0
        public void Assert(object target, MethodInfo method, string localFunctionName, Occurs occurs, params object[] args)
        {
            ProfilerInterceptor.GuardInternal(() =>
            {
                Type type = target.GetType();
                MethodInfo localFunction = MockingUtil.GetLocalFunction(type, method, localFunctionName);

                Mock.NonPublic.Assert(target, localFunction, occurs, args);
            });
        }
        public void Assert(object target, string methodName, Type[] methodParamTypes, string localFunctionName, Occurs occurs, Type[] methodGenericTypes, Type[] localFunctionGenericTypes, params object[] args)
        {
            ProfilerInterceptor.GuardInternal(() =>
            {
                MethodInfo method         = MockingUtil.GetMethodWithLocalFunction(target, methodName, methodParamTypes, methodGenericTypes);
                List <Type> combinedTypes = new List <Type>();
                combinedTypes.AddRange(methodGenericTypes);
                combinedTypes.AddRange(localFunctionGenericTypes);

                MethodInfo localMethod = MockingUtil.GetLocalFunction(target.GetType(), method, localFunctionName, combinedTypes.ToArray());

                Mock.NonPublic.Assert(target, localMethod, occurs, args);
            });
        }
        public object Call(object target, string methodName, Type[] methodParamTypes, string localFunctionName, Type[] methodGenericTypes, Type[] localFunctionGenericTypes, params object[] args)
        {
            return(ProfilerInterceptor.GuardInternal(() =>
            {
                MethodInfo method = MockingUtil.GetMethodWithLocalFunction(target, methodName, methodParamTypes, methodGenericTypes);
                List <Type> combinedTypes = new List <Type>();
                combinedTypes.AddRange(methodGenericTypes);
                combinedTypes.AddRange(localFunctionGenericTypes);

                MethodInfo localMethod = MockingUtil.GetLocalFunction(target.GetType(), method, localFunctionName, combinedTypes.ToArray());

                return Mock.NonPublic.MakePrivateAccessor(target).CallMethod(localMethod, args);
            }));
        }
        public ActionExpectation Arrange(Type type, string methodName, Type[] methodParamTypes, string localMemberName, Type[] methodGenericTypes, Type[] localFunctionGenericTypes, params object[] args)
        {
            return(ProfilerInterceptor.GuardInternal(() =>
            {
                MethodInfo method = MockingUtil.GetMethodWithLocalFunction(type, methodName, methodParamTypes, methodGenericTypes);
                List <Type> combinedTypes = new List <Type>();
                combinedTypes.AddRange(methodGenericTypes);
                combinedTypes.AddRange(localFunctionGenericTypes);

                MethodInfo localMethod = MockingUtil.GetLocalFunction(type, method, localMemberName, combinedTypes.ToArray());

                return Mock.NonPublic.Arrange(type, localMethod, args);
            }));
        }