상속: IPulseLogger
예제 #1
0
// ReSharper disable InconsistentNaming
        public void PulseLogger_Ctor_CheckValues_ExpectInitialised()
// ReSharper restore InconsistentNaming
        {
            //------------Setup for test--------------------------
            var pulseLogger = new PulseLogger(25);
            Assert.AreEqual(pulseLogger.Interval,25);
            PrivateObject pvt = new PrivateObject(pulseLogger);
            System.Timers.Timer timer = (System.Timers.Timer)pvt.GetField("_timer");
            Assert.AreEqual(false,timer.Enabled);
            
            //------------Execute Test---------------------------

            //------------Assert Results-------------------------
        }
// ReSharper disable InconsistentNaming
        public void PulseLogger_Ctor_Start_ExpectInitialised()
// ReSharper restore InconsistentNaming
        {
            //------------Setup for test--------------------------
            var pulseLogger = new PulseLogger(2500);
            
            Assert.AreEqual(pulseLogger.Interval, 2500);
            PrivateObject pvt = new PrivateObject(pulseLogger);
            System.Timers.Timer timer = (System.Timers.Timer)pvt.GetField("_timer");
            timer.Elapsed += TimerElapsed;
            Assert.AreEqual(false, timer.Enabled);
            pulseLogger.Start();
            Thread.Sleep(4000);
            //------------Execute Test---------------------------
            Assert.IsTrue(_elapsed);
            //------------Assert Results-------------------------
        }