示例#1
0
        public void Test_BothNull()
        {
            IntSegmentCondition <AggregateRootSample, int> condition = new IntSegmentCondition <AggregateRootSample, int>(t => t.Tel, null, null);

            Assert.Null(condition.GetCondition());

            IntSegmentCondition <AggregateRootSample, int?> criteria2 = new IntSegmentCondition <AggregateRootSample, int?>(t => t.Age, null, null);

            Assert.Null(criteria2.GetCondition());
        }
示例#2
0
        public void Test_GetPredicate_MinGreaterMax()
        {
            IntSegmentCondition <AggregateRootSample, int> condition = new IntSegmentCondition <AggregateRootSample, int>(t => t.Tel, 10, 1);

            Assert.Equal("t => ((t.Tel >= 1) AndAlso (t.Tel <= 10))", condition.GetCondition().ToString());

            IntSegmentCondition <AggregateRootSample, int?> criteria2 = new IntSegmentCondition <AggregateRootSample, int?>(t => t.Age, 10, 1);

            Assert.Equal("t => ((t.Age >= 1) AndAlso (t.Age <= 10))", criteria2.GetCondition().ToString());
        }
示例#3
0
        public void Test_GetPredicate_MaxIsNull()
        {
            IntSegmentCondition <AggregateRootSample, int> condition = new IntSegmentCondition <AggregateRootSample, int>(t => t.Tel, 1, null);

            Assert.Equal("t => (t.Tel >= 1)", condition.GetCondition().ToString());

            IntSegmentCondition <AggregateRootSample, int?> criteria2 = new IntSegmentCondition <AggregateRootSample, int?>(t => t.Age, 1, null);

            Assert.Equal("t => (t.Age >= 1)", criteria2.GetCondition().ToString());
        }
示例#4
0
        public void Test_GetPredicate_Boundary()
        {
            IntSegmentCondition <AggregateRootSample, int> condition = new IntSegmentCondition <AggregateRootSample, int>(t => t.Tel, 1, 10, Boundary.Neither);

            Assert.Equal("t => ((t.Tel > 1) AndAlso (t.Tel < 10))", condition.GetCondition().ToString());

            condition = new IntSegmentCondition <AggregateRootSample, int>(t => t.Tel, 1, 10, Boundary.Left);
            Assert.Equal("t => ((t.Tel >= 1) AndAlso (t.Tel < 10))", condition.GetCondition().ToString());

            IntSegmentCondition <AggregateRootSample, int?> criteria2 = new IntSegmentCondition <AggregateRootSample, int?>(t => t.Age, 1, 10, Boundary.Right);

            Assert.Equal("t => ((t.Age > 1) AndAlso (t.Age <= 10))", criteria2.GetCondition().ToString());

            criteria2 = new IntSegmentCondition <AggregateRootSample, int?>(t => t.Age, 1, 10, Boundary.Both);
            Assert.Equal("t => ((t.Age >= 1) AndAlso (t.Age <= 10))", criteria2.GetCondition().ToString());
        }