Exemple #1
0
        public void StopCounter()
        {
            ICounterManager manager = new CounterManager(CPU_Processor_Time_Counter);

            bool startState;
            bool endState;

            //start counter on its own thread
            var thread = new Thread(() => manager.StartCounter());

            try
            {
                thread.Start();
                startState = manager.GetStartStopState();
                manager.StopCounter();
                endState = manager.GetStartStopState();

                Assert.IsFalse(startState);
                Assert.IsTrue(endState);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }

            thread.Abort();
        }