コード例 #1
0
        private void ResetLimit(object sender, ElapsedEventArgs e)
        {
            TimerContext context = (TimerContext)sender;

            context.CanUseCommand = true;
            context.Stop();
        }
コード例 #2
0
        public void TimerContext_Start_ContinuesTiming()
        {
            TimerContext context = new TimerContext("some-name", new Logger(), LogLevelEnum.LOG_DEBUG);

            context.Start();
            Thread.Sleep(5);
            context.Stop();
            var firstTime = context.GetElapsedTime();

            context.Start();
            Thread.Sleep(5);
            context.Stop();
            var secondTime = context.GetElapsedTime();

            Assert.True(firstTime > 0);
            Assert.True(secondTime > firstTime);
        }
コード例 #3
0
 public void Stop() =>
 _timerContext.Stop();