Пример #1
0
        public void DateTime_Equals()
        {
            var builder = new QueryBuilder();

            builder.AddClause("AccountBalance", 1000000098987868767, Operator.Equal, Connector.And);

            var engine = new FilterEngine();

            var expression = engine.BuildPredicate <Person>(builder.Clauses);
            var result     = Persons.Where(expression);

            Assert.True(result.Count() == 1);
        }
Пример #2
0
        public void DateTime_LessThanOrEqual()
        {
            var builder = new QueryBuilder();

            builder.AddClause("BirthDate", new DateTime(1990, 03, 2), Operator.LessThanOrEqual, Connector.And);

            var engine = new FilterEngine();

            var expression = engine.BuildPredicate <Person>(builder.Clauses);
            var result     = Persons.Where(expression);

            Assert.True(result.Count() == 2);
        }
Пример #3
0
        public void Decimal_Equals()
        {
            var builder = new QueryBuilder();

            builder.AddClause("Debit", 100m, Operator.Equal, Connector.And);

            var engine = new FilterEngine();

            var expression = engine.BuildPredicate <Person>(builder.Clauses);
            var result     = Persons.Where(expression);

            Assert.True(result.Count() == 1);
        }
Пример #4
0
        public void IsMatch_Equal_And_StringStatement_SimpleStatements_Success()
        {
            var builder = new QueryBuilder();

            builder.AddClause("Name", "Ana", Operator.Equal, Connector.And);
            builder.AddClause("Age", 32, Operator.Equal, Connector.Or);

            var engine = new FilterEngine();

            var dictionary = new Dictionary <string, object>();

            dictionary.Add("Name", "Ana");
            dictionary.Add("Age", 32);

            var obj = dictionary.BuildTargetObject();

            var isValid = engine.Evaluate(obj, builder.Clauses);

            var expression = engine.BuildPredicate <Person>(builder.Clauses);

            var result = Persons.Where(expression);

            Assert.True(result.Count() == 1);
        }