| | |
| | | [TestClass] |
| | | public class UnitTest1 |
| | | { |
| | | |
| | | |
| | | [TestMethod] |
| | | public void TestMethoEntityValidati2222zzz() |
| | | { |
| | | var hour = DateTime.Now.Hour; |
| | | if (!(hour == 1 || hour == 3 || hour == 5 || hour == 6)) |
| | | { |
| | | var ss = ""; |
| | | } |
| | | else |
| | | { |
| | | var dd = ""; |
| | | } |
| | | } |
| | | |
| | | [TestMethod] |
| | | public void TestMethoEntityValidatizzz() |
| | | { |
| | | try |
| | | { |
| | | WorkPieceLog aa = null; |
| | | using (DbModel db = new DbModel()) |
| | | { |
| | | aa = db.WorkPieceLog.Where(x => x.Id == 588877956636741).FirstOrDefault(); |
| | | } |
| | | |
| | | // aa.WorkPieceID = "DZ045L2409100102791PAT"; |
| | | var isRight = SystemBussinessHelper.ValidateIsRightWorkPieceID(aa.WorkPieceID); |
| | | if (isRight) |
| | | { |
| | | } |
| | | } |
| | | catch (DbEntityValidationException dbEx) |
| | | { |
| | | //var bb = dbEx.EntityValidationErrors.ToList(); |
| | | //var pp = bb.First().ValidationErrors.ToList(); |
| | | //var z = JsonConvert.SerializeObject(pp); |
| | | |
| | | var errorMessages = |
| | | dbEx.EntityValidationErrors |
| | | .SelectMany(validationResult => validationResult.ValidationErrors) |
| | | .Select(m => m.ErrorMessage); |
| | | |
| | | var fullErrorMessage = string.Join(", ", errorMessages); |
| | | |
| | | //throw new DbEntityValidationException(exceptionMessage, exception.EntityValidationErrors); |
| | | } |
| | | catch (Exception) |
| | | { |
| | | |
| | | throw; |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | [TestMethod] |
| | | public void TestMethoEntityValidationErrors() |
| | | { |