Ejemplo n.º 1
0
        public static void StatisticCommonAdminTestInitialize(TestContext testContext)
        {
            Logging.SetMode(Logging.LOG_MODE.FILE_EXE);

            int    errCode = -1;
            string errMess = string.Empty;

            ASUTP.Database.FIleConnSett fileCS;
            List <ASUTP.Database.ConnectionSettings> listConnSett;

            listConnSett = new List <ASUTP.Database.ConnectionSettings> ();
            fileCS       = new ASUTP.Database.FIleConnSett("connsett.ini", ASUTP.Database.FIleConnSett.MODE.FILE);
            fileCS.ReadSettingsFile(-1, out listConnSett, out errCode, out errMess);
            new DbTSQLConfigDatabase(
                //new ASUTP.Database.ConnectionSettings("CONFIG_DB", "10.100.104.18", "", 1433, "techsite_cfg-2.X.X", "Stat_user", "5tat_u%ser")
                listConnSett [0]
                );
            DbTSQLConfigDatabase.DbConfig().Register();

            using (new HStatisticUsers(DbTSQLConfigDatabase.DbConfig().ListenerId, ASUTP.Helper.HUsers.MODE_REGISTRATION.USER_DOMAINNAME)) {
                ;
            }
            FormMain.formGraphicsSettings = new FormGraphicsSettings(delegate(int arg) {
            }
                                                                     , delegate() {
            }
                                                                     , false
                                                                     );

            panel = new PanelAdminKomDisp(new HMark(new int [] { (int)CONN_SETT_TYPE.ADMIN, (int)CONN_SETT_TYPE.PBR }));
            panel.SetDelegateReport(delegate(string mes) {
                // error
                System.Diagnostics.Debug.WriteLine($"Error: {mes}");
            }, delegate(string mes) {
                // warning
                System.Diagnostics.Debug.WriteLine($"Warning: {mes}");
            }, delegate(string mes) {
                // action
                System.Diagnostics.Debug.WriteLine($"Action: {mes}");
            }, delegate(bool bClear) {
                // clear
            });

            DbTSQLConfigDatabase.DbConfig().UnRegister();

            Assert.IsNotNull(panel);

            panel.Start();
            panel.InitializeComboBoxTecComponent(FormChangeMode.MODE_TECCOMPONENT.GTP);
            panel.Activate(true);
            Assert.IsTrue(panel.Actived);

            //Task.Factory.StartNew (() => {
            //    System.Threading.Thread.Sleep (42000);
            //});
        }
        public static void StatisticCommonAdminTestInitialize(TestContext testContext)
        {
            if (!(testContext.TestName.IndexOf("Export_PBR") < 0))
            {
                _formRequired |= FormRequired.Parameters;
            }
            else
            {
                ;
            }

            //Application.ThreadException += new ThreadExceptionEventHandler(Application_ThreadException);
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);

            FormMainBase.s_iMainSourceData = 671;

            Logging.SetMode(Logging.LOG_MODE.FILE_EXE);

            Logging.Logg().PostStart(ASUTP.Helper.ProgramBase.MessageWellcome);

            int    errCode = -1;
            string errMess = string.Empty;

            ASUTP.Database.FIleConnSett fileCS;
            List <ASUTP.Database.ConnectionSettings> listConnSett;

            listConnSett = new List <ASUTP.Database.ConnectionSettings> ();
            fileCS       = new ASUTP.Database.FIleConnSett("connsett.ini", ASUTP.Database.FIleConnSett.MODE.FILE);
            fileCS.ReadSettingsFile(-1, out listConnSett, out errCode, out errMess);
            new DbTSQLConfigDatabase(
                //new ASUTP.Database.ConnectionSettings("CONFIG_DB", "10.100.104.18", "", 1433, "techsite_cfg-2.X.X", "Stat_user", "5tat_u%ser")
                listConnSett [0]
                );
            DbTSQLConfigDatabase.DbConfig().Register();

            using (new HStatisticUsers(DbTSQLConfigDatabase.DbConfig().ListenerId, ASUTP.Helper.HUsers.MODE_REGISTRATION.USER_DOMAINNAME)) {
                ;
            }

            foreach (FormRequired req in Enum.GetValues((typeof(FormRequired))))
            {
                if ((_formRequired & req) == req)
                {
                    switch (req)
                    {
                    case FormRequired.No:
                        continue;

                    case FormRequired.GraphicsSettings:
                        FormMain.formGraphicsSettings = new FormGraphicsSettings(delegate(int arg) {
                        }
                                                                                 , delegate() {
                        }
                                                                                 , false
                                                                                 );
                        break;

                    case FormRequired.Parameters:
                        FormMain.formParameters = new FormParameters_DB();
                        break;

                    default:
                        Assert.Fail($"{req} не обрабатывается...");
                        break;
                    }
                }
                else
                {
                    ;
                }
            }

            panel = new PanelAdminKomDisp(new HMark(new int [] { (int)CONN_SETT_TYPE.ADMIN, (int)CONN_SETT_TYPE.PBR }));
            panel.SetDelegateReport(delegate(string mes) {
                // error
                System.Diagnostics.Debug.WriteLine($"Error: {mes}");
            }, delegate(string mes) {
                // warning
                System.Diagnostics.Debug.WriteLine($"Warning: {mes}");
            }, delegate(string mes) {
                // action
                System.Diagnostics.Debug.WriteLine($"Action: {mes}");
            }, delegate(bool bClear) {
                // clear
            });

            DbTSQLConfigDatabase.DbConfig().UnRegister();

            Assert.IsNotNull(panel);

            panel.Start();
            panel.InitializeComboBoxTecComponent(FormChangeMode.MODE_TECCOMPONENT.GTP, true);
            panel.Activate(true);
            Assert.IsTrue(panel.Actived);

            //Task.Factory.StartNew (() => {
            //    System.Threading.Thread.Sleep (42000);
            //});
        }