/// <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)); }
/// <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)); }
/// <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)); }
/// <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)); }