/// <inheritdoc /> public ISelectStatementBuilder WithWhereCondition(IConditionModel whereCondition) { if (whereCondition == null) { throw new ArgumentNullException(nameof(whereCondition)); } whereCondition.DatabaseProvider = DatabaseProvider; _whereConditions.Add(whereCondition); return(this); }
public void WithWhereCondition_GivenNullCondition_ShouldThrowException() { //---------------Set up test pack------------------- var testTableName = "TestTable"; IConditionModel whereCondition = null; //---------------Assert Precondition---------------- //---------------Execute Test ---------------------- // ReSharper disable once ExpressionIsAlwaysNull var exception = Assert.Throws <ArgumentNullException>(() => SelectStatementBuilder.Create .WithTable(testTableName) .WithWhereCondition(whereCondition) .Build()); //---------------Test Result ----------------------- Assert.AreEqual("whereCondition", exception.ParamName); }
/// <summary> /// Compound Condition Data Model constructor /// </summary> /// <param name="leftCondition">Left Condition</param> /// <param name="booleanOperator">Boolean Operator</param> /// <param name="rightCondition">Right Condition</param> public CompoundConditionModel(IConditionModel leftCondition, BooleanOperator booleanOperator, IConditionModel rightCondition) { LeftCondition = leftCondition ?? throw new ArgumentNullException(nameof(leftCondition)); BooleanOperator = booleanOperator; RightCondition = rightCondition ?? throw new ArgumentNullException(nameof(rightCondition)); }