/// <summary> /// Initialises <see cref="SQLCommandDecorator"/> with a single commandBuilder object. /// </summary> public SQLCommandDecorator(ISQLCommandBuilder commandBuilder) { _commandBuilders = new List <ISQLCommandBuilder>() { commandBuilder }; }
public void TestGenericParamSmallerThanInt(int testInt) { expected = $"<= {testInt}"; searchParameter = new SearchParameterDecorator <int>(testInt); searchParameter = new SmallerThanDecorator(searchParameter); Assert.AreEqual(expected, searchParameter.ToSQLString); }
public void TestGenericParamBetweenInt(int lowInt, int highInt) { expected = $"BETWEEN {lowInt} AND {highInt}"; searchParameter = new SearchParameterDecorator <int>(lowInt, highInt); searchParameter = new BetweenDecorator(searchParameter); Assert.AreEqual(expected, searchParameter.ToSQLString); }
public void TestGenericParamBetweenSameNumberDouble(double testDouble) { expected = $"BETWEEN {testDouble} AND {testDouble}"; searchParameter = new SearchParameterDecorator <double>(testDouble, testDouble); searchParameter = new BetweenDecorator(searchParameter); Assert.AreEqual(expected, searchParameter.ToSQLString); }
public void TestGenericParamLargerThanDouble(double testDouble) { expected = $">= {testDouble}"; searchParameter = new SearchParameterDecorator <double>(testDouble); searchParameter = new LargerThanDecorator(searchParameter); Assert.AreEqual(expected, searchParameter.ToSQLString); }
public void TestGenericParamBetweenDouble(double lowDouble, double highDouble) { expected = $"BETWEEN {lowDouble} AND {highDouble}"; searchParameter = new SearchParameterDecorator <double>(lowDouble, highDouble); searchParameter = new BetweenDecorator(searchParameter); Assert.AreEqual(expected, searchParameter.ToSQLString); }
public void TestGenericParamBetweenSameNumberInt(int testInt) { expected = $"BETWEEN {testInt} AND {testInt}"; searchParameter = new SearchParameterDecorator <int>(testInt, testInt); searchParameter = new BetweenDecorator(searchParameter); Assert.AreEqual(expected, searchParameter.ToSQLString); }
public void TestRemoveQuotes(string testString) { string escapedString = new string(testString).Replace("'", "''"); expected = $"{escapedString}"; searchParameter = new TextSearchParameterDecorator(testString); Assert.AreEqual(expected, searchParameter.ToSQLString); }
public void TestTrim(string testString) { string trimmedString = new string(testString).Trim(); expected = $"{trimmedString}"; searchParameter = new TextSearchParameterDecorator(testString); Assert.AreEqual(expected, searchParameter.ToSQLString); }
public void TestTextParamExact(string testString) { expected = $"LIKE '{testString}'"; searchParameter = new TextSearchParameterDecorator(testString); searchParameter = new TextWrapDecorator(searchParameter); searchParameter = new LikeDecorator(searchParameter); Assert.AreEqual(expected, searchParameter.ToSQLString); }
public void TestTextParamInclude(string testString) { expected = $@"LIKE '%{testString}%'"; searchParameter = new TextSearchParameterDecorator(testString); searchParameter = new WildCardWrapDecorator(searchParameter); searchParameter = new TextWrapDecorator(searchParameter); searchParameter = new LikeDecorator(searchParameter); Assert.AreEqual(expected, searchParameter.ToSQLString); }
public void TestGenericParamSmallerThanDate(string testDate) { expected = $"<= '{testDate}'"; DateAsParam dateAsParam = new DateAsParam(testDate); searchParameter = new SearchParameterDecorator <DateAsParam>(dateAsParam); searchParameter = new SmallerThanDecorator(searchParameter); Assert.AreEqual(expected, searchParameter.ToSQLString); }
public void TestGenericParamBetweenSameNumberDate(string testDate) { expected = $"BETWEEN '{testDate}' AND '{testDate}'"; DateAsParam dateAsParam = new DateAsParam(testDate); searchParameter = new SearchParameterDecorator <DateAsParam>(dateAsParam, dateAsParam); searchParameter = new BetweenDecorator(searchParameter); Assert.AreEqual(expected, searchParameter.ToSQLString); }
public void TestGenericParamBetweenDate(string lowDate, string highDate) { expected = $"BETWEEN '{lowDate}' AND '{highDate}'"; DateAsParam low = new DateAsParam(lowDate); DateAsParam high = new DateAsParam(highDate); searchParameter = new SearchParameterDecorator <DateAsParam>(low, high); searchParameter = new BetweenDecorator(searchParameter); Assert.AreEqual(expected, searchParameter.ToSQLString); }
/// <inheritdoc/> public ExactLikeDecorator(ISQLCommandBuilder searchParameter) : base(searchParameter) { _modifier = "LIKE"; }
/// <inheritdoc/> public EqualDecorator(ISQLCommandBuilder searchParameter) : base(searchParameter) { _modifier = "="; }
/// <inheritdoc/> public SmallerThanDecorator(ISQLCommandBuilder commandBuilder) : base(commandBuilder) { _modifier = "<="; }
/// <inheritdoc/> public LargerThanDecorator(ISQLCommandBuilder searchParameter) : base(searchParameter) { _modifier = ">="; }
public TextWrapDecorator(ISQLCommandBuilder commandBuilder) { _commandBuilder = commandBuilder; _startWrap = "\'"; _endWrap = _startWrap; }
public WildCardWrapDecorator(ISQLCommandBuilder commandBuilder) { _commandBuilder = commandBuilder; _startWrap = "%"; _endWrap = _startWrap; }
/// <inheritdoc/> public LikeDecorator(ISQLCommandBuilder commandBuilder) : base(commandBuilder) { _modifier = "LIKE"; }
/// <inheritdoc/> public BetweenDecorator(ISQLCommandBuilder searchParameter) : base(searchParameter) { _modifier = "BETWEEN"; }
/// <summary> /// Initialises a <see cref="SearchParameterDecorator{T}"/> with 2 search parameters. Used only for the BETWEEN keyword in a command. /// </summary> /// <param name="lowSearchParameter">Search parameter of type T, lower or equal to highSearchParameter</param> /// <param name="highSearchParameter">Search parameter of type T, higher or equal to lowSearchParameter</param> public SearchParameterDecorator(T lowSearchParameter, T highSearchParameter) { _baseSearchParameter = lowSearchParameter; _searchParameter = new SearchParameterDecorator <T>(highSearchParameter); }