コード例 #1
0
        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);
        }
コード例 #2
0
        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");
    }
コード例 #4
0
        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());
        }
コード例 #7
0
        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
ファイル: HQLQueryParser.cs プロジェクト: pmsun-bruce/DBTool
        /// <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);
        }