Ejemplo n.º 1
0
        OracleServer SetupOracleServer(ErrorResultTO errors)
        {
            var server = new OracleServer();

            try
            {
                var connected = server.Connect(Source.ConnectionString, CommandType.StoredProcedure, ProcedureName);
                if (!connected)
                {
                    Dev2Logger.Error(string.Format(ErrorResource.FailedToConnectWithConnectionString,
                                                   Source.ConnectionString), GlobalConstants.WarewolfError);
                }
                return(server);
            }
            catch (OracleException oex)
            {
                var errorMessages = new StringBuilder();
                errorMessages.Append(oex.Message);
                errors.AddError(errorMessages.ToString());
                Dev2Logger.Error(errorMessages.ToString(), GlobalConstants.WarewolfError);
            }
            catch (Exception ex)
            {
                errors.AddError($"{ex.Message}{Environment.NewLine}{ex.StackTrace}");
                Dev2Logger.Error(ex, GlobalConstants.WarewolfError);
            }
            return(server);
        }
        // ReSharper disable InconsistentNaming
        public void OracleServer_Connect_ConnectionStringIsInvalid_ThrowsArgumentException()
        // ReSharper restore InconsistentNaming
        {
            //------------Setup for test--------------------------
            var sqlServer = new OracleServer();

            try
            {
                //------------Execute Test---------------------------
                sqlServer.Connect("xxx", CommandType.Text, null);

                //------------Assert Results-------------------------
            }
            finally
            {
                sqlServer.Dispose();
            }
        }
Ejemplo n.º 3
0
        public void OracleServer_Connect_ConnectionStringIsNull_ThrowsArgumentNullException()

        {
            //------------Setup for test--------------------------
            var sqlServer = new OracleServer();

            try
            {
                //------------Execute Test---------------------------
                sqlServer.Connect(null, CommandType.Text, null);

                //------------Assert Results-------------------------
            }
            finally
            {
                sqlServer.Dispose();
            }
        }