Cucumber/Cloud/Validation/FarmValidator.cs

18 lines
551 B
C#
Raw Normal View History

2024-10-29 00:40:58 +04:00
using Cloud.Requests;
using FluentValidation;
namespace Cloud.Validation
{
public class FarmValidator : AbstractValidator<FarmRequest>
{
public FarmValidator()
{
RuleFor(request => request.RaspberryIP)
.NotEmpty().WithMessage("IP address can't be empty")
.Matches(@"^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)\.?\b){4}$").WithMessage("IP address is not valid");
2024-10-29 00:40:58 +04:00
RuleFor(request => request.Name)
.NotEmpty().WithMessage("Name can't be empty");
}
}
}