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]); }
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(); }
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(); }
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(); }
public void Do_not_send_data_and_reset_when_nothing_registered_after_GetValues() { var timer = new TimerAbsentFilter(new Timer(MonitorConfig.Build("Test"))); timer.Record(() => 42); timer.GetValuesAndReset(); timer.GetValues().ShouldBeEquivalentTo(new IMeasurement[0]); ((ITimer)timer).GetValuesAndReset().ShouldBeEquivalentTo(new IMeasurement[0]); }