public void AddCall(IProxyCall call, SetupKind kind) { var expr = call.SetupExpression.PartialMatcherAwareEval(); var keyText = call.Method.DeclaringType.FullName + "::" + expr.ToStringFixed(true); if (kind == SetupKind.PropertySet) { keyText = "set::" + keyText; } var constants = new ConstantsVisitor(expr).Values; var key = new ExpressionKey(keyText, constants); if (!call.IsConditional) { // if it's not a conditional call, we do // all the override setups. // TODO maybe add the conditionals to other // record like calls to be user friendly and display // somethig like: non of this calls were performed. if (calls.ContainsKey(key)) { // Remove previous from ordered calls orderedCalls.Remove(calls[key]); } calls[key] = call; } orderedCalls.Add(call); }
public void AddCall(IProxyCall call, SetupKind kind) { var expr = call.SetupExpression.PartialMatcherAwareEval(); var keyText = call.Method.DeclaringType.FullName + "::" + expr.ToStringFixed(true); if (kind == SetupKind.PropertySet) { keyText = "set::" + keyText; } var constants = new ConstantsVisitor(expr).Values; var key = new ExpressionKey(keyText, constants); if (!call.IsConditional) { // if it's not a conditional call, we do // all the override setups. // TODO maybe add the conditionals to other // record like calls to be user friendly and display // somethig like: non of this calls were performed. if (calls.ContainsKey(key)) { // Remove previous from ordered calls InterceptionContext.RemoveOrderedCall(calls[key]); } calls[key] = call; } InterceptionContext.AddOrderedCall(call); }