public void TestAllStatementBuilderPartialFunctions()
        {
            StatementBuilder statementBuilder = new StatementBuilder()
              .Select("Name, Id")
              .From("Geo_Target")
              .Where("Targetable = :targetable")
              .OrderBy("Id DESC")
              .Limit(StatementBuilder.SUGGESTED_PAGE_LIMIT)
              .Offset(0)
              .AddValue("targetable", true)
              .IncreaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT)
              .RemoveLimitAndOffset();
              Assert.AreEqual(null, statementBuilder.GetOffset());

              Statement expectedStatement = new Statement();
              expectedStatement.query = "SELECT Name, Id FROM Geo_Target"
              + " WHERE Targetable = :targetable ORDER BY Id DESC";
              String_ValueMapEntry targetableEntry = new String_ValueMapEntry();
              targetableEntry.key = "targetable";
              BooleanValue targetableValue = new BooleanValue();
              targetableValue.value = true;
              targetableEntry.value = targetableValue;
              expectedStatement.values = new String_ValueMapEntry[] {targetableEntry};
              Assert.True(StatementsAreEqual(expectedStatement, statementBuilder.ToStatement()));
        }
    /// <summary>
    /// Run the code example.
    /// </summary>
    /// <param name="user">The DFP user object running the code example.</param>
    public override void Run(DfpUser user) {
      // Get the InventoryService.
      PublisherQueryLanguageService pqlService =
          (PublisherQueryLanguageService) user.GetService(
              DfpService.v201208.PublisherQueryLanguageService);

      // Create statement to select all targetable cities.
      // A limit of 500 is set here. You may want to page through such a large
      // result set. For criteria that do not have a "targetable" property, that
      // predicate may be left off, i.e. just "SELECT * FROM Browser_Groups
      // LIMIT 500"
      StatementBuilder statementBuilder =
          new StatementBuilder("SELECT * FROM City WHERE targetable = true LIMIT 500");

      try {
        // Get all cities.
        ResultSet resultSet = pqlService.select(statementBuilder.ToStatement());

        // Display results.
        Console.WriteLine(PqlUtilities.ResultSetToString(resultSet));
      } catch (Exception ex) {
        Console.WriteLine("Failed to get all cities. Exception says \"{0}\"",
            ex.Message);
      }
    }
        public void TestStatementBuilderBlankStatement()
        {
            StatementBuilder statementBuilder = new StatementBuilder();

              Statement expectedStatement = new Statement();
              expectedStatement.query = "";
              expectedStatement.values = new String_ValueMapEntry[0];

              Assert.True(StatementsAreEqual(expectedStatement,
                                     statementBuilder.ToStatement()));
        }
        public void TestStatementBuilderBasicStatement()
        {
            StatementBuilder statementBuilder = new StatementBuilder()
              .Where("ID = 1");

              Statement expectedStatement = new Statement();
              expectedStatement.query = "WHERE ID = 1";
              expectedStatement.values = new String_ValueMapEntry[0];

              Assert.True(StatementsAreEqual(expectedStatement,
                                     statementBuilder.ToStatement()));
        }
        public void TestStatementBuilderIncludesKeywordPrefix()
        {
            StatementBuilder statementBuilder = new StatementBuilder()
              .Where("WHEREWITHALL = 1");

              Statement expectedStatement = new Statement();
              expectedStatement.query = "WHERE WHEREWITHALL = 1";
              expectedStatement.values = new String_ValueMapEntry[0];

              Assert.True(StatementsAreEqual(expectedStatement,
            statementBuilder.ToStatement()));
        }