本文整理汇总了C#中Query.And方法的典型用法代码示例。如果您正苦于以下问题:C# Query.And方法的具体用法?C# Query.And怎么用?C# Query.And使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Query
的用法示例。
在下文中一共展示了Query.And方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestAnd
public void TestAnd()
{
var q = new Query("Release.Name", Query.Operator.Equals, "My Release");
Assert.AreEqual(q.QueryClause, "(Release.Name = \"My Release\")");
Query q2 = q.And(new Query("Iteration.Name", Query.Operator.Equals, "My Iteration"));
Assert.AreEqual(q2.QueryClause, "((Release.Name = \"My Release\") AND (Iteration.Name = \"My Iteration\"))");
}
示例2: TestNestedFilters
public void TestNestedFilters()
{
//Arrange
Query query = new Query();
query.Or(
query.And(
query.Field("city").Equal("Los Angeles"),
query.Field("score").Equal("38")
),
query.Or(
query.Field("last_name").Equal("Kok"),
query.Field("first_name").Equal("Chun")
)
);
//Assert
AreEqualQueries("filters={\"$or\":[{\"$and\":[{\"city\":{\"$eq\":\"Los Angeles\"}},{\"score\":{\"$eq\":\"38\"}}]},{\"$or\":[{\"last_name\":{\"$eq\":\"Kok\"}},{\"first_name\":{\"$eq\":\"Chun\"}}]}]}",query);
}
示例3: QueryToFindEntriesWhereNameBeginsWithCoffeeANDTelephoneIsBlank
public void QueryToFindEntriesWhereNameBeginsWithCoffeeANDTelephoneIsBlank()
{
//Arrange
var query = new Query();
query.And(query.Field("name").BeginsWith("Coffee"), query.Field("tel").Blank());
//Assert
AreEqualQueries("filters={\"$and\":[{\"name\":{\"$bw\":\"Coffee\"}},{\"tel\":{\"$blank\":true}}]}", query);
}
示例4: AddToQuery
/// <summary>
/// Adds Between search criteria to a Query if the search controls are not empty
/// </summary>
/// <param name="queryDefinition">The query to add the criteria to</param>
/// <param name="column">The column to search on</param>
/// <param name="searchControlBegin">The search control with the lowest value</param>
/// <param name="searchControlEnd">The search control with the highest value</param>
protected void AddToQuery(Query queryDefinition, Enum column, HtmlInputText searchControlBegin, HtmlInputText searchControlEnd)
{
if (searchControlBegin.Value.Length > 0 && searchControlEnd.Value.Length > 0)
{
//
// Two values specified, use Between
//
queryDefinition.And(Criteria.Create(column, Condition.Is, Comparison.Between, searchControlBegin.Value, searchControlEnd.Value));
}
else if (searchControlBegin.Value.Length > 0)
{
//
// Low value specified, use GreaterThanOrEqualTo
//
queryDefinition.And(Criteria.Create(column, Condition.Is, Comparison.GreaterThanOrEqualTo, searchControlBegin.Value));
}
else if (searchControlEnd.Value.Length > 0)
{
//
// High value specified, use GreaterThanOrEqualTo
//
queryDefinition.And(Criteria.Create(column, Condition.Is, Comparison.LessThanOrEqualTo, searchControlEnd.Value));
}
}
示例5: TestWorldGeographies
public void TestWorldGeographies()
{
//Arrange
var query = new Query();
query.And
(
query.Field("name").Equal("philadelphia"),
query.Field("country").Equal("us"),
query.Field("placetype").Equal("locality")
);
//Act
var response = Factual.Fetch("world-geographies", query);
//Assert
AssertReceivedOkResponse(response);
dynamic json = JsonConvert.DeserializeObject(response);
Assert.IsTrue(((int)json.response.included_rows) == 14);
}
示例6: TestInvalidAnd
public void TestInvalidAnd()
{
//Arrange
var query = new Query();
query.And
(
query.Field("category").BeginsWith("Food"),
query.WithIn(new Circle(Latitude, Longitude, Meters))
);
//Act
var response = Factual.Fetch("places", query);
//Assert
AssertReceivedOkResponse(response);
}