public void SimpleWhere() { var expression = WhereTestQueryGenerator.CreateSimpleWhereQuery(QuerySource).Expression; var queryModel = QueryParser.GetParsedQuery(expression); Assert.That(queryModel.MainFromClause.ItemName, Is.EqualTo("s")); var whereClause = (WhereClause)queryModel.BodyClauses[0]; CheckResolvedExpression <Cook, bool> (whereClause.Predicate, queryModel.MainFromClause, s => s.Name == "Garcia"); var selectClause = queryModel.SelectClause; CheckResolvedExpression <Cook, Cook> (selectClause.Selector, queryModel.MainFromClause, s => s); }
public void WhereWithDifferentComparisons() { var expression = WhereTestQueryGenerator.CreateWhereQueryWithDifferentComparisons(QuerySource).Expression; var queryModel = QueryParser.GetParsedQuery(expression); CheckConstantQuerySource(queryModel.MainFromClause.FromExpression, QuerySource); var whereClause = (WhereClause)queryModel.BodyClauses[0]; CheckResolvedExpression <Cook, bool> (whereClause.Predicate, queryModel.MainFromClause, s => s.FirstName != "Garcia" && s.ID > 5 && s.ID >= 6 && s.ID < 7 && s.ID <= 6 && s.ID == 6); var selectClause = queryModel.SelectClause; CheckResolvedExpression <Cook, Cook> (selectClause.Selector, queryModel.MainFromClause, s => s); }
public void ThreeWheres() { var expression = WhereTestQueryGenerator.CreateMultiWhereQuery(QuerySource).Expression; var queryModel = QueryParser.GetParsedQuery(expression); Assert.That(queryModel.BodyClauses.Count, Is.EqualTo(3)); var whereClause1 = (WhereClause)queryModel.BodyClauses[0]; CheckResolvedExpression <Cook, bool> (whereClause1.Predicate, queryModel.MainFromClause, s => s.Name == "Garcia"); var whereClause2 = (WhereClause)queryModel.BodyClauses[1]; CheckResolvedExpression <Cook, bool> (whereClause2.Predicate, queryModel.MainFromClause, s => s.FirstName == "Hugo"); var whereClause3 = (WhereClause)queryModel.BodyClauses[2]; CheckResolvedExpression <Cook, bool> (whereClause3.Predicate, queryModel.MainFromClause, s => s.ID > 100); var selectClause = queryModel.SelectClause; CheckResolvedExpression <Cook, Cook> (selectClause.Selector, queryModel.MainFromClause, s => s); }