Info
Version: | 1.6.0 |
Author(s): | FluentValidationGuard |
Last Update: | Friday, March 27, 2020 |
.NET Fiddle: | Create the first Fiddle |
NuGet Url: | https://www.nuget.org/packages/FluentValidationGuard |
Install
Install-Package FluentValidationGuard
dotnet add package FluentValidationGuard
paket add FluentValidationGuard
FluentValidationGuard Download (Unzip the "nupkg" after downloading)
Dependencies
- AutoFixture(>= 4.11.0)
- FluentAssertions(>= 5.10.3)
Tags
public static void Example(string name, int age)
{
try
{
Validator
.Begin(name, nameof(name))
.NotNull()
.NotWhiteSpace()
.Map(age, nameof(age))
.IsGreaterOrEquals(18)
.TrowIfHasErrors(nameof(ErrorConverter), nameof(Example));
}
catch (ValidationException e)
{
Console.WriteLine(e);
IErrorConverter converter = new ErrorConverter();
var errors = converter.Convert(e);
Console.WriteLine(errors);
}
}.