示例#1
0
        /// <summary>
        ///     Called when a value is read from the indexer.
        ///     This implementation will select the alternative branch if the get condition evaluates to <c>true</c>.
        /// </summary>
        /// <param name="mockInfo">Information about the mock through which the value is read.</param>
        /// <param name="key">The indexer key used.</param>
        /// <returns>The value being read.</returns>
        public override TValue Get(IMockInfo mockInfo, TKey key)
        {
            if (_getCondition?.Invoke(mockInfo.MockInstance, key) ?? false)
            {
                return(IfBranch.Get(mockInfo, key));
            }

            return(base.Get(mockInfo, key));
        }
示例#2
0
        /// <summary>
        ///     Called when a value is read from the property.
        ///     This implementation will select the alternative branch if the get condition evaluates to <c>true</c>.
        /// </summary>
        /// <param name="mockInfo">Information about the mock through which the value is read.</param>
        /// <returns>The value being read.</returns>
        public override TValue Get(IMockInfo mockInfo)
        {
            if (_getCondition?.Invoke() ?? false)
            {
                return(IfBranch.Get(mockInfo));
            }

            return(base.Get(mockInfo));
        }
示例#3
0
 /// <summary>
 ///     Called when a value is read from the indexer, and redirects the call onto the if branch.
 /// </summary>
 /// <param name="mockInfo">Information about the mock through which the value is read.</param>
 /// <param name="key">The indexer key used.</param>
 /// <returns>The value being read.</returns>
 public override TValue Get(IMockInfo mockInfo, TKey key)
 {
     return(IfBranch.Get(mockInfo, key));
 }
示例#4
0
 /// <summary>
 ///     Called when a value is read from the property, and redirects calls onto the if branch.
 /// </summary>
 /// <param name="mockInfo">Information about the mock through which the value is read.</param>
 /// <returns>The value being read.</returns>
 public override TValue Get(IMockInfo mockInfo)
 {
     return(IfBranch.Get(mockInfo));
 }