public void Test1()
        {
            BaseValidator <Employee> validator = new EmployeeValidator();
            var employee = new Employee
            {
                FirstName = "",
                LastName  = ""
            };
            var result = validator.IsValid(employee);

            Assert.That(result, Is.EqualTo(false));
        }
Exemple #2
0
 public bool Create(EmployeeView model)
 {
     try
     {
         EmployeeValidator validator = new EmployeeValidator(model);
         if (!validator.IsValid())
         {
             throw new Exception(validator.GetErrors());
         }
         return(this.Repository.Create(model));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }