本文整理汇总了C#中Query.Field方法的典型用法代码示例。如果您正苦于以下问题:C# Query.Field方法的具体用法?C# Query.Field怎么用?C# Query.Field使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Query
的用法示例。
在下文中一共展示了Query.Field方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestOr
public void TestOr()
{
Query query = new Query().Field("region").In("MA", "VT", "NH");
query.Or(
query.Field("first_name").Equal("Chun"),
query.Field("last_name").Equal("Kok")
);
//Assert
AreEqualQueries("filters={\"$and\":[{\"region\":{\"$in\":[\"MA\",\"VT\",\"NH\"]}},{\"$or\":[{\"first_name\":{\"$eq\":\"Chun\"}},{\"last_name\":{\"$eq\":\"Kok\"}}]}]}", query);
}
示例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: 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);
}
示例5: TestNestedOrWithinTheTopLevelAnd
public void TestNestedOrWithinTheTopLevelAnd()
{
//Arrange & Act
var query = new Query().Field("region").In("MA", "VT", "NH");
query.Or
(
query.Field("name").BeginsWith("Coffee"),
query.Field("name").BeginsWith("Star")
);
var response = Factual.Fetch("places", query);
AssertReceivedOkResponse(response);
AssertNotEmpty(response);
AssertStartsWithEither(response, "name", "Coffee", "Star");
var raw = Factual.RawQuery("t/places", "filters={\"$and\":[{\"region\":{\"$in\":[\"MA\",\"VT\",\"NH\"]}},{\"$or\":[{\"name\":{\"$bw\":\"Coffee\"}},{\"name\":{\"$bw\":\"Star\"}}]}]}");
//Assert
Assert.AreEqual(response, raw);
}
示例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);
}