예제 #1
0
        /// <summary>
        /// Configures the spy to do nothing. This is also the default behaviour
        /// for a new spy and results in a default value being returned if the
        /// method is a function.
        /// </summary>
        /// <returns>The spy.</returns>
        public SpyWithBehaviour DoNothing()
        {
            _spy.Behaviours.Clear();
            var behaviour = new DefaultBehaviour();

            behaviour.UpdateLifetime(int.MaxValue);
            behaviour.ParameterChangesBeforeExecution = _parameterChanges;
            _spy.Behaviours.Enqueue(behaviour);
            return(new SpyWithBehaviour(_spy, behaviour));
        }
예제 #2
0
        private Spy(MethodInfo method, object key)
        {
            Method = method;
            Key    = key;

            // setup up spy to only return a default value forever
            var defaultBehaviour = new DefaultBehaviour();

            defaultBehaviour.UpdateLifetime(int.MaxValue);
            Behaviours.Enqueue(defaultBehaviour);
        }