Exemple #1
0
        public void TestRun02()
        {
            DbStatusMonitorThread monitorThreadTemp = new DbStatusMonitorThread();

            ThreadStart threadStartFunction = new ThreadStart(monitorThreadTemp.Run);
            Thread      workerThread        = new Thread(threadStartFunction);

            monitorThreadTemp.UpdateStatusHandler += DBConnectionStrings.GetInstance().UpdateDBStatus;

            monitorThreadTemp.AddItem(TestDBInit.localConnectionString1);

//             try
//             {
//                 monitorThreadTemp.Run();
//             }
//             catch (System.Exception ex)
//             {
//
//             }

            workerThread.Start();

            //stub localList.Remove(localList[i]); throw exception

            Thread.Sleep(1000);
            monitorThreadTemp.TerminateThread();
        }
Exemple #2
0
        public void TestAllFunctions()
        {
            monitorThread.AddItem(TestDBInit.localConnectionString1);

            bool isTerminated = monitorThread.IsTerminated();

            // monitorThread.Run();

            monitorThread.TerminateThread();
        }
Exemple #3
0
        public void TestRun03()
        {
            DbStatusMonitorThread monitorThreadTemp = new DbStatusMonitorThread();

            ThreadStart threadStartFunction = new ThreadStart(monitorThreadTemp.Run);
            Thread      workerThread        = new Thread(threadStartFunction);

            monitorThreadTemp.UpdateStatusHandler += DBConnectionStrings.GetInstance().UpdateDBStatus;

            Accessor threadAccessor = ReflectionAccessor.Wrap(monitorThreadTemp);

            threadAccessor.SetField("m_terminate", false);
            workerThread.Start();
            monitorThreadTemp.AddItem(TestDBInit.localConnectionString1);

            Thread.Sleep(300);
            monitorThreadTemp.TerminateThread();
        }