public static void NumericConditions <TProperty>(IDictionary <string, IValueTypeCondition <TProperty> > conditions) where TProperty : struct, IComparable, IComparable <TProperty>, IEquatable <TProperty>
 {
     conditions["none"]               = new ValueTypeNoneCondition <TProperty>("None");
     conditions["equal"]              = new ValueTypeEqualCondition <TProperty>("Equal");
     conditions["notequal"]           = new ValueTypeNotEqualCondition <TProperty>("NotEqual");
     conditions["between"]            = new BetweenCondition <TProperty>("Between");
     conditions["lessthan"]           = new LessThanCondition <TProperty>("LessThan");
     conditions["greaterthan"]        = new GreaterThanCondition <TProperty>("GreaterThan");
     conditions["lessthanorequal"]    = new LessThanOrEqualCondition <TProperty>("LessThanOrEqual");
     conditions["greaterthanorequal"] = new GreaterThanOrEqualCondition <TProperty>("GreaterThanOrEqual");
     conditions["isnull"]             = new ValueTypeIsNullCondition <TProperty>("IsNull");
     conditions["isnotnull"]          = new ValueTypeIsNotNullCondition <TProperty>("IsNotNull");
 }
        public void LessThanOrEqualCondition()
        {
            var lessThanOrEqualCondition = new LessThanOrEqualCondition <decimal>();

            var expr1 = lessThanOrEqualCondition.For <TestSource>(x => x.Price);

            Assert.IsNull(expr1);

            lessThanOrEqualCondition.Value = new FilterValue <decimal?>
            {
                LeftValue = 1M
            };

            var expr2 = lessThanOrEqualCondition.For <TestSource>(x => x.Price);

            Assert.IsFalse(expr2.Compile()(new TestSource {
                Price = 2
            }));

            lessThanOrEqualCondition.Value = new FilterValue <decimal?>
            {
                LeftValue = 5M
            };

            var expr3 = lessThanOrEqualCondition.For <TestSource>(x => x.Price);

            Assert.IsTrue(expr3.Compile()(new TestSource {
                Price = 5
            }));

            lessThanOrEqualCondition.Value = new FilterValue <decimal?>
            {
                LeftValue = 5M
            };

            var expr4 = lessThanOrEqualCondition.For <TestSource>(x => x.Price);

            Assert.IsTrue(expr4.Compile()(new TestSource {
                Price = 4
            }));
        }