コード例 #1
0
 public void TestSetValidationHandler2()
 {
     user = new User2();
     if (user.IsValidated.Not())
     {
         Assert.AreEqual("姓名不能为空", this.user.ValidationResult.First().ErrorMessage);
     }
 }
コード例 #2
0
 public void TestSetValidationHandler()
 {
     this.user = new User2 {
         Name = "3"
     };
     if (this.user.IsValidated.Not())
     {
         Assert.AreEqual("姓名长度不能小于2", user.ValidationResult.First().ErrorMessage);
     }
 }
コード例 #3
0
 public void TestAddValidationRule()
 {
     user = new User2 {
         Name = "123"
     };
     user.AddValidationRule(new ContainsHXHValidationRule(this.user.Name));
     if (this.user.IsValidated.Not())
     {
         Assert.AreEqual("姓名必须包含HXH", user.ValidationResult.First().ErrorMessage);
     }
 }
コード例 #4
0
 public void TestInit()
 {
     Ioc.Register(new IocConfig());
     this.user = new User2();
 }