I have model
public class DocProperty
{
public int Size {get; set;}
public int Volume {get; set;}
...
}
and I'm using FluentValidation
public class DocPropertyValidator: AbstractValidator<DocProperty>
{
public DocPropertyValidator()
{
RuleFor(a => a.Size).Must(x => x < 1).WithMessage("Invalid Size!");
RuleFor(a => a.Volume ).Must(x => x < 1).WithMessage("Invalid Volume!");
}
}
My question is:
How can I use FluentValidation and validate case when Volume < Size
.
In this case print Invalid case, volume cannot be less then Size.