コード例 #1
0
        public void OpenCloseConnectionDatabaseDoesntExist()
        {
            try
            {
                String connectionString = String.Format(s_ConnectionString, "UnknownDatabaseName");

                SqlCommands commands = new SqlCommands(m_ProviderFactory, connectionString, connectionString, 1);

                DbConnection connection = commands.CreateConnection(true);

                commands.ReleaseConnection(connection);
                connection = null;
            }
            catch (StackHashException ex)
            {
                Assert.AreEqual(true, ex.ContainsExceptionType(typeof(SqlException)));
                Assert.AreEqual(StackHashServiceErrorCode.SqlConnectionError, ex.ServiceErrorCode);
                throw;
            }
        }