using FluentValidation.Results;
using System;

namespace FluentValidationExample
{
    class Program
    {
        static void Main(string[] args)
        {
            var zamowienie = new Zamowienie
            {
                Numer = "abc",
                Odbiorca = "John Kowalski",
                AdresDostawy = string.Empty,
                Email = "Absdr",
                DataZlozenia = DateTime.Now.AddDays(-2),
                DataWyslania = DateTime.Now.AddDays(-3),
                DataDostarczenia = DateTime.Now.AddDays(2)
            };

            ZamowienieValidator validator = new ZamowienieValidator();

            ValidationResult results = validator.Validate(zamowienie);

            if (!results.IsValid)
            {
                foreach (var failure in results.Errors)
                {
                    //Console.WriteLine("Property " + failure.PropertyName + " failed validation. Error was: " + failure.ErrorMessage);
                    Console.WriteLine(failure.ErrorMessage);
                }
            }
        }
    }
}
