コード例 #1
0
        /// <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);
        }
コード例 #2
0
ファイル: GivenSelector.cs プロジェクト: tmorgner/gro-game
        /// <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);
        }
コード例 #3
0
        public IAssertionScope ForCondition(bool condition)
        {
            if (predecessorSucceeded)
            {
                return(predecessor.ForCondition(condition));
            }

            return(this);
        }
コード例 #4
0
        /// <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);
        }