Ejemplo n.º 1
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Override the Call method so that we can find the return value for the passed-in
        /// parameters.
        /// </summary>
        /// <param name="parameters"></param>
        /// <returns>The return value set up for the passed-in parameters; otherwise
        /// <c>null</c></returns>
        /// ------------------------------------------------------------------------------------
        public override object Call(params object[] parameters)
        {
            // loop over all the set up method calls
            for (int i = 0; i < expectations.Count; i++)
            {
                MockCall mockCall = expectations[i];
                if (parameters.Length != mockCall.ExpectedArgs.Length)
                {
                    continue;
                }

                // Now compare all the parameters
                bool fFoundAllParams = true;
                for (int j = 0; j < parameters.Length; j++)
                {
                    IConstraint constraint = mockCall.ExpectedArgs[j];
                    fFoundAllParams = (fFoundAllParams && constraint.Eval(parameters[j]));
                }

                if (fFoundAllParams)
                {
                    return(mockCall.Call(signature.methodName, parameters));
                }
            }
            return(null);
        }
Ejemplo n.º 2
0
        public virtual object Call(params object[] parameters)
        {
            MockCall mockCall = expectations[timesCalled];

            timesCalled++;
            return(mockCall.Call(signature.methodName, parameters));
        }
Ejemplo n.º 3
0
        public virtual object Call(params object[] parameters)
        {
            object obj = expectation.Call(name, parameters);

            timesCalled++;
            return(obj);
        }
Ejemplo n.º 4
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Override the Call method so that we can wrap around if called to often
        /// </summary>
        /// <param name="parameters"></param>
        /// <returns></returns>
        /// ------------------------------------------------------------------------------------
        public override object Call(params object[] parameters)
        {
            MockCall mockCall = expectations[timesCalled];

            timesCalled++;
            if (timesCalled >= expectations.Count)
            {
                timesCalled = 0;
            }
            return(mockCall.Call(signature.methodName, parameters));
        }
 public virtual object Call(params object[] parameters)
 {
     return(call.Call(name, parameters));
 }