public static void Show(SqlCommandException e) { var f = new SqlCommandExceptionDetails(); Utils.RegisterAutoDisposableForm(f); f.Initialize(e); f.ShowDialog(); }
public void ExIsSqlCommandExceptionAndDoesNotContainSqlErrorWithNumberIs2_ReturnsFalse() { // Arrange var sqlError = SqlClientUtil.CreateSqlError(0); var sqlException = SqlClientUtil.CreateSqlException(sqlError); var ex = new SqlCommandException(null, sqlException, null); // Act var isTransient = LeaderboardsStoreClient.IsTransient(ex); // Assert Assert.False(isTransient); }
public void CommandTextIsNull_ReturnsSqlCommandExceptionAsString() { // Arrange string message = null; SqlException inner = null; string commandText = null; // Act var ex = new SqlCommandException(message, inner, commandText); // Assert Assert.Equal("toofz.Data.SqlCommandException: Exception of type 'toofz.Data.SqlCommandException' was thrown.", ex.ToString()); }
public void SetsCommandText() { // Arrange string message = null; SqlException inner = null; string commandText = "myCommandText"; // Act var ex = new SqlCommandException(message, inner, commandText); // Assert Assert.Equal(commandText, ex.CommandText); }
public void ReturnsSqlCommandException() { // Arrange string message = null; SqlException inner = null; string commandText = null; // Act var ex = new SqlCommandException(message, inner, commandText); // Assert Assert.IsAssignableFrom <SqlCommandException>(ex); }
public void Initialize(SqlCommandException e) { tbSql.Text = e.Sql; // rander errors tbErrors.Clear(); var b = new StringBuilder(); foreach (SqlError er in e.SqlException.Errors) { b.AppendFormat("{0}: {1}", er.LineNumber, er.Message); b.AppendLine(); } tbErrors.Text = b.ToString(); }
public void ReturnsSqlException() { // Arrange var message = "myMessage"; var innerException = SqlClientUtil.CreateSqlException(); var commandText = "myCommandText"; var ex = new SqlCommandException(message, innerException, commandText); // Act var innerException2 = ex.InnerException; // Assert Assert.IsAssignableFrom <SqlException>(innerException2); }
public void ReturnsSqlCommandExceptionAsString() { // Arrange string message = null; SqlException inner = null; string commandText = "myCommandText"; // Act var ex = new SqlCommandException(message, inner, commandText); // Assert Assert.Equal(@"toofz.Data.SqlCommandException: Exception of type 'toofz.Data.SqlCommandException' was thrown. myCommandText", ex.ToString(), ignoreLineEndingDifferences: true); }