Exemplo n.º 1
0
        /// <summary>
        ///     Called when an event handler is being added to the mocked event.
        ///     This implementation logs before and after the event has been added, along with any exceptions thrown.
        /// </summary>
        /// <param name="mockInfo">Information about the mock through which the event handler is being added.</param>
        /// <param name="value">The event handler that is being added.</param>
        public override void Add(IMockInfo mockInfo, THandler?value)
        {
            _logContext.LogBeforeEventAdd(mockInfo, value);
            try
            {
                base.Add(mockInfo, value);
            }
            catch (Exception exception)
            {
                _logContext.LogEventAddException(mockInfo, exception);
                throw;
            }

            _logContext.LogAfterEventAdd(mockInfo);
        }