public void DynamicQueryFilterShouldBeValidated() { // Arrange var input = new GetListInput { FilterGroup = new DynamicQueryGroup { Type = GroupType.Add, Conditions = new List <DynamicQueryCondition> { new DynamicQueryCondition { FieldName = "1234", Operator = DynamicQueryOperator.Equal, Value = "a" }, new DynamicQueryCondition { FieldName = "a b", Operator = DynamicQueryOperator.Equal, Value = "a b" }, } } }; // Act var ex = Assert.Throws <AbpValidationException>(() => _service.TestDynamicQueryInputValidationMethod(input)); // Assert ex.ValidationErrors.Count.ShouldBe(2); ex.ValidationErrors[0].MemberNames.ShouldBe(new[] { nameof(DynamicQueryCondition.FieldName) }); ex.ValidationErrors[0].ErrorMessage.ShouldBe("InvalidFieldName: 1234"); ex.ValidationErrors[1].MemberNames.ShouldBe(new[] { nameof(DynamicQueryCondition.FieldName) }); ex.ValidationErrors[1].ErrorMessage.ShouldBe("InvalidFieldName: a b"); }
public virtual void TestDynamicQueryInputValidationMethod(GetListInput input) { }