/// <summary>
 /// Creates a new filter instance with the given property and equality criteria
 /// </summary>
 /// <param name="propertyName">The name of the Content property to test against</param>
 /// <param name="equalityValue">The String value to compare against</param>
 /// <param name="equality">The equality operator to use for comparison - defaults to In</param>
 /// <exception cref="ArgumentException">Thrown if the provided propertyName is invalid</exception>
 public InclusionSearchFilter(string propertyName, string equalityValue, InEquality equality = InEquality.In)
 {
     if(string.IsNullOrEmpty(propertyName)) throw new ArgumentException("Property Name must be specified");
     Field = propertyName;
     Comparison = (equality == InEquality.In ? SearchFilterComparer.In : SearchFilterComparer.NotIn).ToString();
     Value = equalityValue;
 }
Ejemplo n.º 2
0
        public void BinaryInEqualTest()
        {
            InEquality op = new InEquality();

            Assert.AreEqual(t, new BinaryStatement(op, tn, fn).Evaluate(varTable));
            Assert.AreEqual(f, new BinaryStatement(op, tn, tn).Evaluate(varTable));
            Assert.AreEqual(t, new BinaryStatement(op, oneIntn, zeroIntn).Evaluate(varTable));
            Assert.AreEqual(f, new BinaryStatement(op, an, an).Evaluate(varTable));
        }
 /// <summary>
 /// Creates a new filter instance with the given property and equality criteria
 /// </summary>
 /// <param name="propertyName">The name of the Content property to test against</param>
 /// <param name="equalityValue">The String value to compare against</param>
 /// <param name="equality">The equality operator to use for comparison - defaults to In</param>
 /// <exception cref="System.ArgumentException">Thrown if the provided propertyName is invalid</exception>
 public InclusionSearchFilter(string propertyName, string equalityValue, InEquality equality = InEquality.In)
 {
     if (string.IsNullOrEmpty(propertyName))
     {
         throw new ArgumentException("Property Name must be specified");
     }
     Field      = propertyName;
     Comparison = (equality == InEquality.In ? SearchFilterComparer.In : SearchFilterComparer.NotIn).ToString();
     Value      = equalityValue;
 }
Ejemplo n.º 4
0
        public void BinaryInEqualErrorTest()
        {
            InEquality op = new InEquality();

            Assert.Throws <System.InvalidOperationException>(() => new BinaryStatement(op, tn, ban).Evaluate(varTable));
            Assert.Throws <System.InvalidOperationException>(() => new BinaryStatement(op, oneFloatn, oneIntn).Evaluate(varTable));
            Assert.Throws <System.InvalidOperationException>(() => new BinaryStatement(op,
                                                                                       oneIntn,
                                                                                       new TemporaryVariable(ref varTable, new String("1"))
                                                                                       ).Evaluate(varTable));
        }