public void IEnumerableContains() { int[] numbers = new[] { 1, 2, 3, 4 }; var query = from w in EktronQueryFactory.Queryable<NumberTestWidget>(_idProvider) where numbers.Contains(w.Number) select w; var propExpr = new IntegerPropertyExpression("Number"); var model = TestHelper.GetQueryModel(query); var actualCriteria = CriteriaGenerator.Generate(model, _idProvider); var expectedCriteria = new AdvancedSearchCriteria { ExpressionTree = (propExpr == numbers[0] | propExpr == numbers[1]) | (propExpr == numbers[2] | propExpr == numbers[3]) }; EkAssert.Equal(expectedCriteria, actualCriteria); }
public void SimpleCast_NoAssignedEktronExpressionType_AllowsCast() { long expectedValue = 1L; var query = from w in EktronQueryFactory.Queryable<CastTestWidget>(_idProvider) where (long)w.NoTypeObjectId == expectedValue select w; var propExpr = new IntegerPropertyExpression("NoTypeObjectId"); var actualTranslation = TestHelper.GetTranslation(query); var expectedTranslation = propExpr == expectedValue; Assert.True(actualTranslation is BinaryExpression); Assert.True( (actualTranslation as BinaryExpression).Left is IntegerPropertyExpression, "Left is not an IntegerPropertyExpression"); EkAssert.Equal(expectedTranslation, actualTranslation); }
public void Nullable_NotEqualsNull() { var query = from w in EktronQueryFactory.Queryable<NullableWidget>() where w.NullableLong != null select w; var actualTranslation = TestHelper.GetTranslation(query); var expectedTranslation = new IntegerPropertyExpression("NullableLong").IsNotNull(); EkAssert.Equal(expectedTranslation, actualTranslation); }
public void Nullable_Equals() { long expectedValue = 1L; var query = from w in EktronQueryFactory.Queryable<NullableWidget>() where w.NullableLong == expectedValue select w; var actualTranslation = TestHelper.GetTranslation(query); var expectedTranslation = new IntegerPropertyExpression("NullableLong").EqualTo(expectedValue); EkAssert.Equal(expectedTranslation, actualTranslation); }
public override void Visit(IntegerPropertyExpression expression) { _expressionString.AppendFormat(" INTEPE'{0}' ", expression.Name); }