Пример #1
0
        private IObjectValidator GetValidator()
        {
            var builder = new ValidationBuilder <InnerValidatableObjectAndCollectionViewModel>();


            builder.RuleFor(vm => vm.InnerObjectValue)
            .NotNull()
            .ModelIsValid();

            builder.RuleForCollection(vm => vm.InnerObjectsCollection)
            .NotNull()
            .Count(3, 5)
            .CollectionElementsAreValid(i => i.Validator?.IsValid != false);


            return(builder.Build(this));
        }