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"
            }));
        }
예제 #3
0
    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
            }));
        }
예제 #5
0
    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);
    }
예제 #6
0
        /// <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);
        }
예제 #8
0
        /// <summary>
        /// 空条件
        /// </summary>
        /// <param name="relation">条件关系</param>
        /// <returns>返回空条件对象</returns>
        public static IsNullCondition IsNull(ConditionRelation relation)
        {
            IsNullCondition cond = new IsNullCondition(relation);

            return(cond);
        }
예제 #9
0
        /// <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();
        }
예제 #10
0
        public void Test_2()
        {
            var condition = new IsNullCondition("");

            Assert.Null(condition.GetCondition());
        }
예제 #11
0
        public void Test_1()
        {
            var condition = new IsNullCondition("Email");

            Assert.Equal("Email Is Null", condition.GetCondition());
        }
예제 #12
0
 private string CompileCondition(IsNullCondition condition)
 {
     return(condition.column.compile(this.traits) + " IS NULL");
 }
예제 #13
0
 /// <summary>
 /// 空条件
 /// </summary>
 /// <param name="column">查询字段对象</param>
 /// <returns>返回空条件对象</returns>
 public static IsNullCondition IsNull(SearchColumn column)
 {
     IsNullCondition cond = new IsNullCondition(column);
     return cond;
 }
예제 #14
0
 /// <summary>
 /// 空条件
 /// </summary>
 /// <returns>返回空条件对象</returns>
 public static IsNullCondition IsNull()
 {
     IsNullCondition cond = new IsNullCondition();
     return cond;
 }
예제 #15
0
        /// <summary>
        /// 空条件
        /// </summary>
        /// <param name="column">查询字段对象</param>
        /// <returns>返回空条件对象</returns>
        public static IsNullCondition IsNull(SearchColumn column)
        {
            IsNullCondition cond = new IsNullCondition(column);

            return(cond);
        }
예제 #16
0
 public static string GenerateSqlFor(IsNullCondition condition)
 {
     return($"{condition.PropertyKey} IS NULL");
 }
예제 #17
0
 /// <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));
 }
예제 #18
0
 public static string GenerateSqlFor(IsNullCondition condition)
 {
     return $"{condition.PropertyKey} IS NULL";
 }
예제 #19
0
        /// <summary>
        /// 空条件
        /// </summary>
        /// <returns>返回空条件对象</returns>
        public static IsNullCondition IsNull()
        {
            IsNullCondition cond = new IsNullCondition();

            return(cond);
        }
예제 #20
0
 /// <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;
 }
예제 #21
0
 /// <summary>
 /// 空条件
 /// </summary>
 /// <param name="relation">条件关系</param>
 /// <returns>返回空条件对象</returns>
 public static IsNullCondition IsNull(ConditionRelation relation)
 {
     IsNullCondition cond = new IsNullCondition(relation);
     return cond;
 }
예제 #22
0
        /// <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);
        }