当前位置: 首页>>代码示例>>C#>>正文


C# Query.And方法代码示例

本文整理汇总了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\"))");
        }
开发者ID:TriHNguyen,项目名称:RallyRestToolkitFor.NET,代码行数:8,代码来源:QueryTest.cs

示例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);
        }
开发者ID:saranmalliga,项目名称:factual-csharp-driver,代码行数:18,代码来源:QueryTests.cs

示例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);
        }
开发者ID:saranmalliga,项目名称:factual-csharp-driver,代码行数:9,代码来源:QueryTests.cs

示例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));

            }
    }
开发者ID:MKsattari,项目名称:palizAmlak,代码行数:34,代码来源:SearchPage.cs

示例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);
        }
开发者ID:aforty,项目名称:factual-csharp-driver,代码行数:18,代码来源:FactualIntegrationTests.cs

示例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);
 }
开发者ID:aforty,项目名称:factual-csharp-driver,代码行数:14,代码来源:FactualIntegrationTests.cs


注:本文中的Query.And方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。