public void RubberStamp_Conditions_IsNullCondition_SetMessage_Test() { var condition = new IsNullCondition <TestClass, string>(p => p.Name) .SetMessage("Error message"); Assert.AreEqual("Error message", condition.Message); }
public void RubberStamp_Conditions_IsNullCondition_String_NotNull_Test() { var condition = new IsNullCondition <TestClass, string>(p => p.Name); Assert.IsFalse(condition.IsValid(new TestClass { Name = "cde" })); }
public void ToStringTest() { var operand = new FakeToStringCondition("Campo"); var sut = new IsNullCondition(operand); var actual = sut.ToString(); actual.Should().Be("Campo Is Null"); }
public void RubberStamp_Conditions_IsNullCondition_NotNullableType_Null_Test() { int index = 1; var condition = new IsNullCondition <TestClass, int>(p => p.Index); Assert.IsFalse(condition.IsValid(new TestClass { Index = index })); }
public void Evaluate(object operandValue, bool expectedResult) { var variables = A.Dummy <IVariableDictionary>(); var operand = A.Fake <IConditionKeyword>(i => i.Strict()); A.CallTo(() => operand.Evaluate(variables)).Returns(operandValue); var sut = new IsNullCondition(operand); var actual = sut.Evaluate(variables); actual.Should().Be(expectedResult); }
/// <summary> /// IS NULL条件解析 /// </summary> /// <param name="condition">需要解析的条件对象</param> /// <returns>返回解析后的条件字符串</returns> protected override string IsNullParse(IsNullCondition condition) { StringBuilder conditionStr = new StringBuilder(" "); string queryColName = condition.SearchColumn.CurrentSearcher.TableName + "." + condition.SearchColumn.ColumnName; if (string.IsNullOrEmpty(condition.SearchColumn.ConditionString)) { conditionStr.Append(queryColName); } else { conditionStr.Append(condition.SearchColumn.ConditionString.Replace(SQLPlaceholder.ColName, queryColName)); } conditionStr.Append(" IS Null "); return(conditionStr.ToString()); }
public void RubberStamp_Conditions_IsNullCondition_Message_Test() { var condition = new IsNullCondition <TestClass, string>(p => p.Name); Assert.AreEqual("The Property Name has to be null", condition.Message); }
/// <summary> /// 空条件 /// </summary> /// <param name="relation">条件关系</param> /// <returns>返回空条件对象</returns> public static IsNullCondition IsNull(ConditionRelation relation) { IsNullCondition cond = new IsNullCondition(relation); return(cond); }
/// <summary> /// IS NULL条件解析 /// </summary> /// <param name="condition">需要解析的条件对象</param> /// <returns>返回解析后的条件字符串</returns> protected override string IsNullParse(IsNullCondition condition) { StringBuilder conditionStr = new StringBuilder(" "); string queryColName = condition.SearchColumn.CurrentSearcher.TableName + "." + condition.SearchColumn.ColumnName; if (string.IsNullOrEmpty(condition.SearchColumn.ConditionString)) { conditionStr.Append(queryColName); } else { conditionStr.Append(condition.SearchColumn.ConditionString.Replace(SQLPlaceholder.ColName, queryColName)); } conditionStr.Append(" IS Null "); return conditionStr.ToString(); }
public void Test_2() { var condition = new IsNullCondition(""); Assert.Null(condition.GetCondition()); }
public void Test_1() { var condition = new IsNullCondition("Email"); Assert.Equal("Email Is Null", condition.GetCondition()); }
private string CompileCondition(IsNullCondition condition) { return(condition.column.compile(this.traits) + " IS NULL"); }
/// <summary> /// 空条件 /// </summary> /// <param name="column">查询字段对象</param> /// <returns>返回空条件对象</returns> public static IsNullCondition IsNull(SearchColumn column) { IsNullCondition cond = new IsNullCondition(column); return cond; }
/// <summary> /// 空条件 /// </summary> /// <returns>返回空条件对象</returns> public static IsNullCondition IsNull() { IsNullCondition cond = new IsNullCondition(); return cond; }
/// <summary> /// 空条件 /// </summary> /// <param name="column">查询字段对象</param> /// <returns>返回空条件对象</returns> public static IsNullCondition IsNull(SearchColumn column) { IsNullCondition cond = new IsNullCondition(column); return(cond); }
public static string GenerateSqlFor(IsNullCondition condition) { return($"{condition.PropertyKey} IS NULL"); }
/// <summary> /// Binary condition for testing if a Path is null. /// </summary> /// <param name="variable"> /// The JSONPath expression that determines which piece of the input document is used for the /// comparison. /// </param> /// <param name="expectedValue">Must be null or not</param> /// <returns></returns> public static IsNullCondition.Builder IsNull(string variable, bool expectedValue) { return(IsNullCondition.GetBuilder().Variable(variable).ExpectedValue(expectedValue)); }
public static string GenerateSqlFor(IsNullCondition condition) { return $"{condition.PropertyKey} IS NULL"; }
/// <summary> /// 空条件 /// </summary> /// <returns>返回空条件对象</returns> public static IsNullCondition IsNull() { IsNullCondition cond = new IsNullCondition(); return(cond); }
/// <summary> /// 空条件 /// </summary> /// <param name="relation">条件关系</param> /// <param name="column">查询字段对象</param> /// <returns>返回空条件对象</returns> public static IsNullCondition IsNull(ConditionRelation relation, SearchColumn column) { IsNullCondition cond = new IsNullCondition(relation, column); return cond; }
/// <summary> /// 空条件 /// </summary> /// <param name="relation">条件关系</param> /// <returns>返回空条件对象</returns> public static IsNullCondition IsNull(ConditionRelation relation) { IsNullCondition cond = new IsNullCondition(relation); return cond; }
/// <summary> /// 空条件 /// </summary> /// <param name="relation">条件关系</param> /// <param name="column">查询字段对象</param> /// <returns>返回空条件对象</returns> public static IsNullCondition IsNull(ConditionRelation relation, SearchColumn column) { IsNullCondition cond = new IsNullCondition(relation, column); return(cond); }