示例#1
0
        public void BothNull_Test()
        {
            IntRangeCriterion <EntityOne, int> criteria = new IntRangeCriterion <EntityOne, int>(t => t.Tel, null, null);

            Assert.Null(criteria.SatisfiedBy());

            IntRangeCriterion <EntityOne, int?> criteria2 = new IntRangeCriterion <EntityOne, int?>(t => t.Age, null, null);

            Assert.Null(criteria2.SatisfiedBy());
        }
示例#2
0
        public void SatisfiedBy_MaxIsNull_Test()
        {
            IntRangeCriterion <EntityOne, int> criteria = new IntRangeCriterion <EntityOne, int>(t => t.Tel, 1, null);

            Assert.Equal("t => (t.Tel >= 1)", criteria.SatisfiedBy().ToString());

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

            Assert.Equal("t => (t.Age >= 1)", criteria2.SatisfiedBy().ToString());
        }
示例#3
0
        public void SatisfiedBy_MinGreaterMax_Test()
        {
            IntRangeCriterion <EntityOne, int> criteria = new IntRangeCriterion <EntityOne, int>(t => t.Tel, 10, 1);

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

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

            Assert.Equal("t => ((t.Age >= 1) AndAlso (t.Age <= 10))", criteria2.SatisfiedBy().ToString());
        }
示例#4
0
        public void SatisfiedBy_Test()
        {
            IntRangeCriterion <EntityOne, int> criteria = new IntRangeCriterion <EntityOne, int>(t => t.Id, 1, 10);

            Assert.Equal("t => ((t.Id >= 1) AndAlso (t.Id <= 10))", criteria.SatisfiedBy().ToString());

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

            Assert.Equal("t => ((t.Age >= 1) AndAlso (t.Age <= 10))", criteria2.SatisfiedBy().ToString());
        }
示例#5
0
        public void SatisfiedBy_Boundary_Test()
        {
            IntRangeCriterion <EntityOne, int> criteria = new IntRangeCriterion <EntityOne, int>(t => t.Tel, 1, 10, Boundary.Neither);

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

            criteria = new IntRangeCriterion <EntityOne, int>(t => t.Tel, 1, 10, Boundary.Left);
            Assert.Equal("t => ((t.Tel >= 1) AndAlso (t.Tel < 10))", criteria.SatisfiedBy().ToString());

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

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

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