示例#1
0
        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);
            }
        }
示例#2
0
        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();
            }
        }
示例#3
0
        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();
            }
        }
示例#6
0
        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();
            }
        }