public void TestAdd_1Result()
 {
     _results.Add(new ValidationResult("a"));
     Assert.Equal(1, _results.Count);
     Assert.Equal("a", _results.First().ErrorMessage);
     Assert.False(_results.IsValid);
 }
Beispiel #2
0
 /// <summary>
 /// 处理验证错误
 /// </summary>
 /// <param name="results">验证错误集合</param>
 public void Handle(ValidationResultCollection results)
 {
     if (results.IsValid)
     {
         return;
     }
     throw new Warning(results.First().ErrorMessage);
 }
Beispiel #3
0
        /// <summary>
        /// 处理验证错误
        /// </summary>
        /// <param name="results">
        /// 验证结果集合
        /// </param>
        public void Handle(ValidationResultCollection results)
        {
            if (results.IsValid)
            {
                return;
            }

            throw new Exception(results.First().ErrorMessage);
        }
Beispiel #4
0
 /// <summary>
 /// 处理验证错误
 /// </summary>
 /// <param name="results">验证错误集合</param>
 public void Handle(ValidationResultCollection results)
 {
     if (results.IsValid)
     {
         return;
     }
     BingConfig.Current.ValidationHandler(results.First().ErrorMessage);
     //throw new Warning(results.First().ErrorMessage);
 }
Beispiel #5
0
 public void TestAdd_1Result()
 {
     _results.Add(new ValidationResult("a"));
     Assert.AreEqual(1, _results.Count);
     Assert.AreEqual("a", _results.First().ErrorMessage);
     Assert.IsFalse(_results.IsValid);
     foreach (var result in _results)
     {
         Assert.AreEqual("a", result.ErrorMessage);
     }
 }
Beispiel #6
0
 /// <summary>
 /// 处理验证错误
 /// </summary>
 /// <param name="results">验证结果集合</param>
 public void Handle( ValidationResultCollection results ) {
     if ( results.IsValid )
         return;
     throw new Warning( results.First().ErrorMessage );
 }