private static bool IsUniqueConstraintViolation(GenericADOException adoException) { Exception innerException = adoException.InnerException; return (innerException != null) && innerException.Message.ToLower().Contains("constraint") && innerException.Message.ToLower().Contains("unique"); }
private static bool AppliesToThisPolicy(GenericADOException adoException) { Exception innerException = adoException.InnerException; return (innerException != null) && innerException.Message.ToLower().Contains("constraint") && innerException.Message.ToLower().Contains("reference"); }
private static bool DataWasTruncated(GenericADOException adoException) { Exception innerException = adoException.InnerException; return (innerException != null) && innerException.Message.ToLower().Contains("truncated"); }
private static void AssertAreEqual( MsSqlServerErrorCode expected, GenericADOException exc) { Assert.IsNotNull(exc); var sqlExc = exc.InnerException as SqlException; Assert.IsNotNull(sqlExc); for (int i = 0; i < sqlExc.Errors.Count; i++) { if (sqlExc.Errors[i].Number == (int)expected) { return; } } Assert.Fail("SQL Error Number {0} was not among the errors", expected); }