public void BuildWhenNotContainsAndEnumTest()
        {
            var criteriaExpression = new CriteriaExpression();

            criteriaExpression.NotContains("Flags", FlagsEnum.One | FlagsEnum.Two);

            var builder    = new CriteriaBuilder();
            var expression = builder.Build <Customer>(criteriaExpression);

            Assert.IsNotNull(expression);
            Assert.AreEqual("Not(((Convert(x.Flags, Int64) | Convert(One, Two, Int64)) == Convert(One, Two, Int64)))", expression.Body.ToString());
        }
        public void BuildWhenNotContainsTest()
        {
            var criteriaExpression = new CriteriaExpression();

            criteriaExpression.NotContains("Name", "value");

            var builder    = new CriteriaBuilder();
            var expression = builder.Build <Customer>(criteriaExpression);

            Assert.IsNotNull(expression);
            Assert.AreEqual("Not(x.Name.Contains(\"value\"))", expression.Body.ToString());
        }
Пример #3
0
        public void ConstructorWhenNotContainsTest()
        {
            var expression = new CriteriaExpression();

            expression.NotContains("Name", "value");

            var criteria = expression.Criterias.FirstOrDefault();

            Assert.IsNotNull(criteria);
            Assert.AreEqual("Name", criteria.Property);
            Assert.AreEqual("value", criteria.Value);
            Assert.AreEqual(null, criteria.Value2);
            Assert.AreEqual(LogicalType.And, criteria.LogicalType);
            Assert.AreEqual(OperationType.NotContains, criteria.OperationType);
        }