Пример #1
0
 /// <summary>
 ///     Called when an event handler is being added to the mocked event.
 ///     This implementation will select the alternative branch if the add condition evaluates to <c>true</c>.
 /// </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)
 {
     if (_addCondition?.Invoke(value) ?? false)
     {
         IfBranch.Add(mockInfo, value);
     }
     else
     {
         base.Add(mockInfo, value);
     }
 }
Пример #2
0
 /// <summary>
 ///     Called when an event handler is being added to the mocked event, and redirects the call onto the if branch.
 /// </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)
 {
     IfBranch.Add(mockInfo, value);
 }