Exemple #1
0
 public void Assert(object target, string methodName, Type[] methodParamTypes, string localFunctionName, params object[] args)
 {
     ProfilerInterceptor.GuardInternal(() =>
     {
         MethodInfo method = MockingUtil.GetMethodWithLocalFunction(target, methodName, methodParamTypes);
         this.Assert(target, method, localFunctionName, args);
     });
 }
Exemple #2
0
 public FuncExpectation <TReturn> Arrange <TReturn>(object target, string methodName, Type[] memberParamTypes, string localFunctionName, params object[] args)
 {
     return(ProfilerInterceptor.GuardInternal(() =>
     {
         MethodInfo method = MockingUtil.GetMethodWithLocalFunction(target, methodName, memberParamTypes);
         return this.Arrange <TReturn>(target, method, localFunctionName, args);
     }));
 }
Exemple #3
0
 public ActionExpectation Arrange(Type type, string methodName, Type[] methodParamTypes, string localMemberName, params object[] args)
 {
     return(ProfilerInterceptor.GuardInternal(() =>
     {
         MethodInfo method = MockingUtil.GetMethodWithLocalFunction(type, methodName, methodParamTypes);
         return this.Arrange(type, method, localMemberName, args);
     }));
 }
Exemple #4
0
        public object Call(object target, string methodName, Type[] methodParamTypes, string localFunctionName, params object[] args)
        {
            return(ProfilerInterceptor.GuardInternal(() =>
            {
                Type type = target.GetType();
                MethodInfo method = MockingUtil.GetMethodWithLocalFunction(target, methodName, methodParamTypes);
                MethodInfo localFunction = MockingUtil.GetLocalFunction(type, method, localFunctionName);

                return Mock.NonPublic.MakePrivateAccessor(target).CallMethod(localFunction, 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);
            }));
        }