public void Throws_NotSupportedException_Whether_The_SelectedCondition_Is_NotIsNull_And_Is_Not_Nullable() { var entity = new object(); var propertyMetadataMock = new Mock <IPropertyMetadata>(); propertyMetadataMock.Setup(metadata => metadata.GetValue(entity)).Returns(null); var enumExpression = new EnumExpression <TestEnum>(false) { SelectedCondition = Condition.NotIsNull }; Assert.Catch <NotSupportedException>(() => enumExpression.CalculateResult(propertyMetadataMock.Object, entity)); }
public void Returns_False_Whether_The_Entity_Property_Value_Is_Null_And_SelectedCondition_Is_NotIsNull() { var entity = new object(); var propertyMetadataMock = new Mock <IPropertyMetadata>(); propertyMetadataMock.Setup(metadata => metadata.GetValue(entity)).Returns(null); var enumExpression = new EnumExpression <TestEnum>(true) { SelectedCondition = Condition.NotIsNull }; Assert.IsFalse(enumExpression.CalculateResult(propertyMetadataMock.Object, entity)); }
public void Returns_False_Whether_The_Entity_Property_Value_Is_Greater_Than_To_Value_And_SelectedCondition_Is_LessThanOrEqualTo() { var entity = new object(); var propertyMetadataMock = new Mock <IPropertyMetadata>(); propertyMetadataMock.Setup(metadata => metadata.GetValue(entity)).Returns(TestEnum.Enum2); var enumExpression = new EnumExpression <TestEnum>(false) { Value = TestEnum.Enum1, SelectedCondition = Condition.LessThanOrEqualTo }; Assert.IsFalse(enumExpression.CalculateResult(propertyMetadataMock.Object, entity)); }
public void Throws_NotSupportedException_Whether_The_SelectedCondition_Is_Not_Supported(Condition condition) { var entity = new object(); var propertyMetadataMock = new Mock <IPropertyMetadata>(); propertyMetadataMock.Setup(metadata => metadata.GetValue(entity)).Returns(TestEnum.Enum1); var enumExpression = new EnumExpression <TestEnum>(false) { Value = TestEnum.Enum1, SelectedCondition = condition }; Assert.Catch <NotSupportedException>(() => enumExpression.CalculateResult(propertyMetadataMock.Object, entity)); }