private int?PreExecution(IRelationalConnection connection)
            {
                int?errorNumber    = null;
                var testConnection = (TestSqlServerConnection)connection;

                testConnection.ExecutionCount++;
                if (testConnection.ExecutionFailures.Count > 0)
                {
                    var fail = testConnection.ExecutionFailures.Dequeue();
                    if (fail.HasValue)
                    {
                        if (fail.Value)
                        {
                            testConnection.DbConnection.Close();
                            throw SqlExceptionFactory.CreateSqlException(testConnection.ErrorNumber);
                        }
                        errorNumber = testConnection.ErrorNumber;
                    }
                }
                return(errorNumber);
            }
        public void Commit()
        {
            if (_testConnection.CommitFailures.Count > 0)
            {
                var fail = _testConnection.CommitFailures.Dequeue();
                if (fail.HasValue)
                {
                    if (fail.Value)
                    {
                        _realTransaction.GetDbTransaction().Rollback();
                    }
                    else
                    {
                        _realTransaction.GetDbTransaction().Commit();
                    }
                    _testConnection.DbConnection.Close();
                    throw SqlExceptionFactory.CreateSqlException(_testConnection.ErrorNumber);
                }
            }

            _realTransaction.Commit();

            ClearTransaction();
        }