Skip to content

An extension of the fluent validation with a set of Brazilian validations

License

Notifications You must be signed in to change notification settings

LucasMendesl/FluentValidation.Extensions.Br

Repository files navigation

FluentValidation.Extensions.Br

An extension of the fluent validation with a set of Brazilian validations

Nuget

🇧🇷 Switch to portuguese version

Main Goal

The prupose of this library is create a extension with brazilian´s validation to FluentValidation package.

Description

This library was designed to provide a set of brazilian´s attributes validation such as CPF, CNPJ

Install

Install with Package Manager

Nuget

PM > Install-Package Extensions.FluentValidation.Br

Install with .NET CLI

.NET CLI

dotnet add package Extensions.FluentValidation.Br

How to Use ?

public class Person
{
    public string Name { get; set; }
    public string CPF  { get; set; }
    public string CNPJ { get; set; }
}

public class PersonValidator : AbstractValidator<Person>
{
  public PersonValidator ()
  {
      RuleFor(employee => employee.Name).NotNull();
      RuleFor(employee => employee.CPF).IsValidCPF();
      RuleFor(employee => employee.CNPJ).IsValidCNPJ();
  }
}

Run Tests

dotnet test

Contributing

Contributions via pull requests are welcome :-).

License

MIT © Lucas Mendes Loureiro