Exemple #1
0
        /// <summary>
        ///     Called when a value is written to the indexer.
        ///     This implementation logs before and after the value has been written, along with any exceptions thrown.
        /// </summary>
        /// <param name="mockInfo">Information about the mock through which the value is written.</param>
        /// <param name="key">The indexer key used.</param>
        /// <param name="value">The value being written.</param>
        public override void Set(IMockInfo mockInfo, TKey key, TValue value)
        {
            _logContext.LogBeforeIndexerSet(mockInfo, key, value);
            try
            {
                base.Set(mockInfo, key, value);
            }
            catch (Exception exception)
            {
                _logContext.LogIndexerSetException(mockInfo, exception);
                throw;
            }

            _logContext.LogAfterIndexerSet(mockInfo);
        }