Esempio n. 1
0
        /// <summary>
        /// Configures the spy to call-through to the original implementation after
        /// recording the call.
        /// </summary>
        /// <returns>The spy.</returns>
        public SpyWithBehaviour CallThrough()
        {
            if (_spy.Key is Guid)
            {
                throw new InvalidOperationException("Cannot call through on dynamic spies.");
            }

            ConstrainPreviousBehaviour();
            var behaviour = new CallThroughBehaviour();

            behaviour.ParameterChangesBeforeExecution = _parameterChanges;
            _spy.Behaviours.Enqueue(behaviour);
            return(new SpyWithBehaviour(_spy, behaviour));
        }
Esempio n. 2
0
        /// <summary>
        /// Configures the spy to call-through to the original implementation after
        /// recording the call.
        /// </summary>
        /// <returns>The spy.</returns>
        public SpyWithBehaviour CallThrough()
        {
            if (_spy.Key is Guid)
            {
                throw new InvalidOperationException("Cannot call through on dynamic spies.");
            }

            _spy.Behaviours.Clear();
            var behaviour = new CallThroughBehaviour();

            behaviour.UpdateLifetime(int.MaxValue);
            behaviour.ParameterChangesBeforeExecution = _parameterChanges;
            _spy.Behaviours.Enqueue(behaviour);
            return(new SpyWithBehaviour(_spy, behaviour));
        }