public void InEnum_IsPopulatedAsExpected() { var ce = ConditionExpression <Test> .In(x => x.DayOfWeek, DayOfWeek.Monday, DayOfWeek.Tuesday); var result = (ConditionExpression)ce; Assert.Equal("ee_dayofweek", result.AttributeName); Assert.Equal(ConditionOperator.In, result.Operator); Assert.Equal(new object[] { (int)DayOfWeek.Monday, (int)DayOfWeek.Tuesday }, result.Values); }
public void In_IsPopulatedAsExpected() { var values = new[] { Guid.NewGuid(), Guid.NewGuid() }; var ce = ConditionExpression <Test> .In(x => x.Id, values); var result = (ConditionExpression)ce; Assert.Equal("ee_testid", result.AttributeName); Assert.Equal(ConditionOperator.In, result.Operator); Assert.Equal(values.Select(x => (object)x), result.Values); }
public void BasicCollectionProperties_MappedAsExpected() { var qe = new QueryExpression <Test> { Conditions = new Collection <ConditionExpression <Test> > { ConditionExpression <Test> .In(x => x.DayOfWeek, DayOfWeek.Friday) }, Orders = new Collection <OrderExpression <Test> > { new OrderExpression <Test>(x => x.Name, OrderType.Ascending) } }; var result = (QueryExpression)qe; var condition = Assert.Single(result.Criteria.Conditions); Assert.Equal("ee_dayofweek", condition.AttributeName); Assert.Equal(ConditionOperator.In, condition.Operator); Assert.Equal(new object[] { (int)DayOfWeek.Friday }, condition.Values); var order = Assert.Single(result.Orders); Assert.Equal("ee_name", order.AttributeName); Assert.Equal(OrderType.Ascending, order.OrderType); }