public void TestSetValidationHandler2() { user = new User2(); if (user.IsValidated.Not()) { Assert.AreEqual("姓名不能为空", this.user.ValidationResult.First().ErrorMessage); } }
public void TestSetValidationHandler() { this.user = new User2 { Name = "3" }; if (this.user.IsValidated.Not()) { Assert.AreEqual("姓名长度不能小于2", user.ValidationResult.First().ErrorMessage); } }
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); } }
public void TestInit() { Ioc.Register(new IocConfig()); this.user = new User2(); }