void IFakeCallProcessor.Process(IInterceptedFakeObjectCall fakeObjectCall) { foreach (var listener in this.interceptionListeners) { listener.OnBeforeCallIntercepted(fakeObjectCall); } var ruleToUse = (from rule in this.AllRules where rule.Rule.IsApplicableTo(fakeObjectCall) && rule.HasNotBeenCalledSpecifiedNumberOfTimes() select rule).First(); try { ApplyRule(ruleToUse, fakeObjectCall); } finally { var readonlyCall = fakeObjectCall.AsReadOnly(); this.RecordCall(readonlyCall); foreach (var listener in this.interceptionListeners.Reverse()) { listener.OnAfterCallIntercepted(readonlyCall, ruleToUse.Rule); } } }
/// <summary> /// Applies an action to the call, might set a return value or throw /// an exception. /// </summary> /// <param name="fakeObjectCall">The call to apply the interceptor to.</param> public void Apply(IInterceptedFakeObjectCall fakeObjectCall) { if (this.recorder.IsRecording) { this.wrappedRule.Apply(fakeObjectCall); this.recorder.RecordCall(fakeObjectCall.AsReadOnly()); } else { this.recorder.ApplyNext(fakeObjectCall); } }
/// <summary> /// Applies an action to the call, might set a return value or throw /// an exception. /// </summary> /// <param name="fakeObjectCall">The call to apply the interceptor to.</param> public void Apply(IInterceptedFakeObjectCall fakeObjectCall) { if (this.recorder.IsRecording) { this.wrappedRule.Apply(fakeObjectCall); this.recorder.RecordCall(fakeObjectCall.AsReadOnly()); } else { this.recorder.ApplyNext(fakeObjectCall); } }
void IFakeCallProcessor.Process(IInterceptedFakeObjectCall fakeObjectCall) { foreach (var listener in this.interceptionListeners) { listener.OnBeforeCallIntercepted(fakeObjectCall); } var ruleToUse = (from rule in this.AllRules where rule.Rule.IsApplicableTo(fakeObjectCall) && rule.HasNotBeenCalledSpecifiedNumberOfTimes() select rule).First(); try { ApplyRule(ruleToUse, fakeObjectCall); } finally { var readonlyCall = fakeObjectCall.AsReadOnly(); this.RecordCall(readonlyCall); foreach (var listener in this.interceptionListeners.Reverse()) { listener.OnAfterCallIntercepted(readonlyCall, ruleToUse.Rule); } } }