/// <summary> /// Adds a new boolean value to the list of query parameters. /// </summary> /// <param name="key">The parameter name.</param> /// <param name="value">The parameter value.</param> /// <returns>The statement builder, for chaining method calls.</returns> public StatementBuilder AddValue(string key, bool value) { BooleanValue queryValue = new BooleanValue(); queryValue.value = value; return AddValue(key, queryValue); }
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())); }