/// ------------------------------------------------------------------------------------ /// <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); }
public virtual object Call(params object[] parameters) { MockCall mockCall = expectations[timesCalled]; timesCalled++; return(mockCall.Call(signature.methodName, parameters)); }
public virtual object Call(params object[] parameters) { object obj = expectation.Call(name, parameters); timesCalled++; return(obj); }
/// ------------------------------------------------------------------------------------ /// <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)); }