public void ShouldBeNull() { // Given var filter = new EqualOperator(EntityType, StringField, null); var satisfyEntity = new FilterTestEntity { StringField = null }; var noSatisfyEntity = new FilterTestEntity { StringField = "NotNull" }; // When var isSatisfy = filter.IsSatisfiedBy(satisfyEntity); var isNoSatisfy = filter.IsSatisfiedBy(noSatisfyEntity); // Then Assert.IsTrue(isSatisfy); Assert.IsFalse(isNoSatisfy); }
public void ShouldBeSupportField() { // Given var entity = new FilterTestEntity { Field = 10 }; var filter = new EqualOperator(EntityType, Field, 10); // When var isSatisfy = filter.IsSatisfiedBy(entity); // Then Assert.IsTrue(isSatisfy); }
public void ShouldBeSupportLambdaExpressionInProperty() { // Given Expression <Func <FilterTestEntity, string> > propertyExpression = item => item.StringField.ToLower(); var entity = new FilterTestEntity { StringField = "AbCd" }; var filter = new EqualOperator(EntityType, propertyExpression, "abcd"); // When var isSatisfy = filter.IsSatisfiedBy(entity); // Then Assert.IsTrue(isSatisfy); }