Exemple #1
0
        public void GivenFalseAndFalse_WhenMatch_ReturnsFalse()
        {
            // Arrange
            var false1 = new TruePredicate();
            var false2 = new FalsePredicate();
            var all    = new AllPredicate(false1, false2);

            // Act
            var actual = all.Match(new HttpRequestMessage());

            // Assert
            Assert.False(actual);
        }
Exemple #2
0
        public void GivenTrueAndTrue_WhenMatch_ReturnsTrue()
        {
            // Arrange
            var true1 = new TruePredicate();
            var true2 = new TruePredicate();
            var all   = new AllPredicate(true1, true2);

            // Act
            var actual = all.Match(new HttpRequestMessage());

            // Assert
            Assert.True(actual);
        }
 /**
  * Create a new Predicate that returns true only if all of the specified
  * predicates are true. The predicates are checked in iterator order.
  * If the collection of predicates is empty, then this predicate returns true.
  *
  * @see org.apache.commons.collections.functors.AllPredicate
  *
  * @param predicates  a collection of predicates to check, may not be null
  * @return the <code>all</code> predicate
  * @throws IllegalArgumentException if the predicates collection is null
  * @throws IllegalArgumentException if any predicate in the collection is null
  */
 public static Predicate allPredicate(java.util.Collection <Object> predicates)
 {
     return(AllPredicate.getInstance(predicates));
 }
 /**
  * Create a new Predicate that returns true only if all of the specified
  * predicates are true.
  * If the array of predicates is empty, then this predicate returns true.
  *
  * @see org.apache.commons.collections.functors.AllPredicate
  *
  * @param predicates  an array of predicates to check, may not be null
  * @return the <code>all</code> predicate
  * @throws IllegalArgumentException if the predicates array is null
  * @throws IllegalArgumentException if any predicate in the array is null
  */
 public static Predicate allPredicate(Predicate[] predicates)
 {
     return(AllPredicate.getInstance(predicates));
 }