使用RuleSets进行FluentValidation测试

时间:2019-01-22 16:00:38

标签: fluentvalidation

我正在为包含这样的RuleSet的FluentValidator编写一些测试:

echo $response['hits']['hits'][0]['_source']['gid'];

我用 RuleSet("Patch", () => { RuleFor(x => x.Name) .NotEmpty(); }); 进行了测试,测试看起来像这样:

FluentValidation.TestHelper

问题是 _sut.ShouldHaveValidationErrorFor(x => x.Name, string.Empty); 不会进入ShouldHaveValidationErrorFor,因此RuleSet支票不会触发。

如何指定要使用NotEmpty“补丁”的测试?

谢谢!

0 个答案:

没有答案