예제 #1
0
        public void Do_not_send_data_and_reset_when_nothing_registered()
        {
            var timer = new TimerAbsentFilter(new Timer(MonitorConfig.Build("Test")));

            timer.GetValuesAndReset().ShouldBeEquivalentTo(new IMeasurement[0]);
            ((ITimer)timer).GetValuesAndReset().ShouldBeEquivalentTo(new IMeasurement[0]);
        }
예제 #2
0
        public void Send_data_when_registered_as_function()
        {
            var timer = new TimerAbsentFilter(new Timer(MonitorConfig.Build("Test")));

            timer.Record(() => 42);

            timer.GetValues().Any().Should().BeTrue();
        }
예제 #3
0
        public void Send_data_when_registered_as_elapsed()
        {
            var timer = new TimerAbsentFilter(new Timer(MonitorConfig.Build("Test")));

            timer.RegisterElapsed(new System.Diagnostics.Stopwatch());

            timer.GetValues().Any().Should().BeTrue();
        }
예제 #4
0
        public void Send_data_when_registered(int someValue)
        {
            var timer = new TimerAbsentFilter(new Timer(MonitorConfig.Build("Test")));

            timer.Register(TimeSpan.FromSeconds(someValue));

            timer.GetValues().Any().Should().BeTrue();
        }
예제 #5
0
        public void Do_not_send_data_when_nothing_registered_after_GetValues()
        {
            var timer = new TimerAbsentFilter(new Timer(MonitorConfig.Build("Test")));

            timer.Register(TimeSpan.FromSeconds(1));
            timer.GetValues();

            timer.GetValues().ShouldBeEquivalentTo(new IMeasurement[0]);
            ((ITimer)timer).GetValues().ShouldBeEquivalentTo(new IMeasurement[0]);
        }
예제 #6
0
 public void FilterTimer_is_an_itimer()
 {
     ITimer timer = new TimerAbsentFilter(new Timer(MonitorConfig.Build("Test")));
 }