< Summary

Information
Class: Api.Request.Validation.CustomerRequestValidator
Assembly: Api
File(s): /home/runner/work/Northwind-Api/Northwind-Api/src/Api/Request/Validation/CustomerRequestValidator.cs
Line coverage
100%
Covered lines: 16
Uncovered lines: 0
Coverable lines: 16
Total lines: 25
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor()100%11100%

File(s)

/home/runner/work/Northwind-Api/Northwind-Api/src/Api/Request/Validation/CustomerRequestValidator.cs

#LineLine coverage
 1using Api.Request.Parameters;
 2using FluentValidation;
 3
 4namespace Api.Request.Validation;
 5
 6public class CustomerRequestValidator : AbstractValidator<CustomerRequest> {
 7  public const int MAX_ID_LENGTH = 55;
 8
 129  public CustomerRequestValidator() {
 610    RuleFor(x => x.CustomerID)
 611        .Cascade(CascadeMode.Stop)
 612        .NotNull()
 613            .WithErrorCode("CustomerID.NotNull")
 614            .WithMessage("Customer Id cannot be null")
 615        .NotEmpty()
 616            .WithErrorCode("CustomerID.NotEmpty")
 617            .WithMessage("Customer Id cannot be empty")
 318        .Must(id => string.IsNullOrWhiteSpace(id) == false)
 619            .WithErrorCode("CustomerID.WhitespaceOnly")
 620            .WithMessage("Customer Id cannot be whitespace")
 621        .MaximumLength(MAX_ID_LENGTH)
 622            .WithErrorCode("CustomerID.TooLong")
 623            .WithMessage($"Customer Id cannot be longer can {MAX_ID_LENGTH}");
 624  }
 25}

Methods/Properties

.ctor()