Пример #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();
        }
Пример #2
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();
        }
Пример #3
0
 public void FixtureSetUp()
 {
     monitorThread = new DbStatusMonitorThread();
 }