public void BuildWhenGreaterThanOrEqualTest() { var criteriaExpression = new CriteriaExpression(); criteriaExpression.GreaterThanOrEqual("Age", 1); var builder = new CriteriaBuilder(); var expression = builder.Build <Customer>(criteriaExpression); Assert.IsNotNull(expression); Assert.AreEqual("(x.Age >= 1)", expression.Body.ToString()); }
public void ConstructorWhenGreaterThanOrEqualTest() { var expression = new CriteriaExpression(); expression.GreaterThanOrEqual("Age", 1); var criteria = expression.Criterias.FirstOrDefault(); Assert.IsNotNull(criteria); Assert.AreEqual("Age", criteria.Property); Assert.AreEqual(1, criteria.Value); Assert.AreEqual(0, criteria.Value2); Assert.AreEqual(LogicalType.And, criteria.LogicalType); Assert.AreEqual(OperationType.GreaterThanOrEqual, criteria.OperationType); }
/// <inheritdoc /> public override IList <CriteriaExpression> GetExpressions() { var expressions = base.GetExpressions(); var expression = new CriteriaExpression(); if (this.CreatedBy != null) { expression.Equal("CreatedBy", this.CreatedBy); } if (this.CreatedDateTo != null) { expression.LessThanOrEqual("CreatedDate", this.CreatedDateTo); } if (this.CreatedDateFrom != null) { expression.GreaterThanOrEqual("CreatedDate", this.CreatedDateFrom); } if (this.EntityTypeName != null) { expression.Equal("EntityTypeName", this.EntityTypeName); } if (this.State != null) { expression.Equal("State", this.State); } if (this.RequestId != null) { expression.Equal("RequestId", this.RequestId); } expressions .Add(expression); return(expressions); }
/// <inheritdoc /> public override IList <CriteriaExpression> GetExpressions() { var expressions = base.GetExpressions(); var expression = new CriteriaExpression(); if (this.BeforeAt.HasValue) { expression.LessThanOrEqual("CreatedAt", this.BeforeAt); } if (this.AfterAt.HasValue) { expression.GreaterThanOrEqual("CreatedAt", this.AfterAt); } expressions .Add(expression); return(expressions); }