/// <summary> /// Specify the condition that must be satisfied upon the subject selected through a prior selector. /// </summary> /// <param name="predicate"> /// If <c>true</c> the assertion will be treated as successful and no exceptions will be thrown. /// </param> /// <remarks> /// The condition will not be evaluated if the prior assertion failed, /// nor will <see cref="FailWith(string, System.Func{T, object}[])"/> throw any exceptions. /// </remarks> public GivenSelector <T> ForCondition(Func <T, bool> predicate) { Guard.ThrowIfArgumentIsNull(predicate, nameof(predicate)); predecessor.ForCondition(predicate(subject)); return(this); }
/// <summary> /// Specify the condition that must be satisfied upon the subject selected through a prior selector. /// </summary> /// <param name="condition"> /// If <c>true</c> the assertion will be treated as successful and no exceptions will be thrown. /// </param> /// <remarks> /// The condition will not be evaluated if the prior assertion failed, nor will <see cref="FailWith(string,System.Func{T,object}[])"/> /// throw any exceptions. /// </remarks> public GivenSelector <T> ForCondition(Func <T, bool> predicate) { if (evaluateCondition) { parentScope.ForCondition(predicate(subject)); } return(this); }
public IAssertionScope ForCondition(bool condition) { if (predecessorSucceeded) { return(predecessor.ForCondition(condition)); } return(this); }
/// <summary> /// Specify the condition that must be satisfied upon the subject selected through a prior selector. /// </summary> /// <param name="predicate"> /// If <c>true</c> the assertion will be treated as successful and no exceptions will be thrown. /// </param> /// <remarks> /// The condition will not be evaluated if the prior assertion failed, /// nor will <see cref="FailWith(string, System.Func{T, object}[])"/> throw any exceptions. /// </remarks> public GivenSelector <T> ForCondition(Func <T, bool> predicate) { predecessor.ForCondition(predicate(subject)); return(this); }