public virtual void Apply(IInterceptedFakeObjectCall fakeObjectCall) { Guard.AgainstNull(fakeObjectCall, nameof(fakeObjectCall)); foreach (var action in this.Actions) { action.Invoke(fakeObjectCall); } this.applicator.Invoke(fakeObjectCall); this.ApplyOutAndRefParametersValueProducer(fakeObjectCall); if (this.CallBaseMethod) { if (EventCall.TryGetEventCall(fakeObjectCall, out var eventCall) && eventCall.IsEventRaiser()) { throw new InvalidOperationException(ExceptionMessages.CannotRaiseEventWhenCallingBaseMethod); } fakeObjectCall.CallBaseMethod(); } else if (this.CallWrappedMethodOn is object wrappedObject) { fakeObjectCall.CallWrappedMethod(wrappedObject); } }
public virtual void Apply(IInterceptedFakeObjectCall fakeObjectCall) { foreach (var action in this.Actions) { action.Invoke(fakeObjectCall); } this.Applicator.Invoke(fakeObjectCall); this.ApplyOutAndRefParametersValues(fakeObjectCall); if (this.CallBaseMethod) { fakeObjectCall.CallBaseMethod(); } }
public virtual void Apply(IInterceptedFakeObjectCall fakeObjectCall) { Guard.AgainstNull(fakeObjectCall, nameof(fakeObjectCall)); foreach (var action in this.Actions) { action.Invoke(fakeObjectCall); } this.applicator.Invoke(fakeObjectCall); this.ApplyOutAndRefParametersValueProducer(fakeObjectCall); if (this.CallBaseMethod) { fakeObjectCall.CallBaseMethod(); } }
public virtual void Apply(IInterceptedFakeObjectCall fakeObjectCall) { Guard.AgainstNull(fakeObjectCall, "fakeObjectCall"); foreach (var action in this.Actions) { action.Invoke(fakeObjectCall); } this.Applicator.Invoke(fakeObjectCall); this.ApplyOutAndRefParametersValueProducer(fakeObjectCall); if (this.CallBaseMethod) { fakeObjectCall.CallBaseMethod(); } }
public virtual void Apply(IInterceptedFakeObjectCall fakeObjectCall) { Guard.AgainstNull(fakeObjectCall, nameof(fakeObjectCall)); foreach (var action in this.Actions) { try { action.Invoke(fakeObjectCall); } catch (Exception ex) when(!(ex is FakeConfigurationException)) { throw new UserCallbackException(ExceptionMessages.UserCallbackThrewAnException("Callback"), ex); } } this.applicator.Invoke(fakeObjectCall); this.ApplyOutAndRefParametersValueProducer(fakeObjectCall); if (this.CallBaseMethod) { fakeObjectCall.CallBaseMethod(); } }