Ejemplo n.º 1
0
        /// <summary>
        /// Destroys the database, if it exists.
        /// </summary>
        /// <returns>A <see cref="ServiceResponse"/> with the results of the operation.</returns>
        public ServiceResponse DestroyDatabase()
        {
            var info = CreateDatabaseInfo();
            if (!DatabaseManager.DatabaseExists(info))
            {
                var existsResponse = new ServiceResponse();
                existsResponse.AddInfo(@"Test database {0}\{1} doesn't exist; nothing to destroy.", info.ServerName, info.DatabaseName);
                return existsResponse;
            }

            var response = _databaseManager.DestroyDatabase(info, null, _publicUserName);
            return response;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Creates the testing database if it doesn't already exist.
        /// </summary>
        /// <returns>A <see cref="ServiceResponse"/> with the results of the operation.</returns>
        public ServiceResponse CreateDatabase()
        {
            var info = CreateDatabaseInfo();

            if (DatabaseManager.DatabaseExists(info))
            {
                var existsResponse = new ServiceResponse();
                existsResponse.AddInfo(@"Test database {0}\{1} already exists.", info.ServerName, info.DatabaseName);
                return existsResponse;
            }

            var response = _databaseManager.CreateDatabase(info, _publicUserName, _publicPassword, _component, _scriptPath, null);

            // adds auditing tables to test schema
            _databaseManager.UpdateDatabaseSchema(info, _publicUserName, "DatabaseScripts.resources", CreateScriptLoader(@"..\..\..\..\..\..\Source\Framework\Auditing\Server\obj\Debug"));

            return response;
        }