Пример #1
0
        public static FakeCall Create <T>(string methodName, Type[] parameterTypes, object[] arguments) where T : class
        {
            var method = typeof(T).GetMethod(methodName, parameterTypes);

            return(new FakeCall
            {
                Method = method,
                Arguments = new ArgumentCollection(arguments, method),
                FakedObject = A.Fake <T>(),
                SequenceNumber = SequenceNumberManager.GetNextSequenceNumber(),
            });
        }
Пример #2
0
        public static FakeCall Create <T>(Expression <Action <T> > callSpecification) where T : class
        {
            var method    = GetMethodInfo(callSpecification);
            var arguments = ((MethodCallExpression)callSpecification.Body).Arguments
                            .Select(ExpressionExtensions.Evaluate)
                            .ToArray();

            return(new FakeCall(
                       method,
                       new ArgumentCollection(arguments, method),
                       A.Fake <T>(),
                       SequenceNumberManager.GetNextSequenceNumber()));
        }