Exemple #1
0
 public void Validate_WithoutRuleName_Valid(string name, int age)
 {
     var customer = new Customer
     {
         Name = name,
         Age = age
     };
     var validationResult = _modelValidator.Validate(customer);
     Assert.AreEqual(true, validationResult.IsValid);
 }
Exemple #2
0
 public void Validate_WithoutRuleName_IsNotValid(string name, int age)
 {
     var customer = new Customer
     {
         Name = name,
         Age = age
     };
     var validationResult = _modelValidator.Validate(customer);
     Assert.AreEqual(false, validationResult.IsValid);
     Assert.AreEqual(2, validationResult.Errors.Count);
 }