我正在为包含这样的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
“补丁”的测试?
谢谢!