Ejemplo n.º 1
0
 public DelegateFakeObjectCall(Delegate instance, MethodInfo method, object[] arguments)
 {
     this.instance  = instance;
     this.Arguments = new ArgumentCollection(arguments, method);
     this.Method    = method;
     SequenceNumberManager.RecordSequenceNumber(this);
 }
        public CastleInvocationCallAdapter(IInvocation invocation)
        {
            this.invocation = invocation;
            this.Method     = invocation.Method;

            this.Arguments = new ArgumentCollection(invocation.Arguments, this.Method);

            SequenceNumberManager.RecordSequenceNumber(this);
        }
Ejemplo n.º 3
0
 private void StubCalls(int numberOfCalls)
 {
     for (int i = 0; i < numberOfCalls; i++)
     {
         var call = A.Fake <ICompletedFakeObjectCall>();
         SequenceNumberManager.RecordSequenceNumber(call);
         this.calls.Add(call);
     }
 }
Ejemplo n.º 4
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(),
            });
        }
Ejemplo n.º 5
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()));
        }