public void Value_is_called_value() { var monitor = new PerformanceCounterMonitor(MonitorConfig.Build("Test"), PerformanceCounterConfig.Build("Process", "Private Bytes", Process.GetCurrentProcess().ProcessName)); monitor.GetValues().Single().Name.Should().Be("value"); }
public void Consists_of_a_single_monitor() { var gauge = new MinGauge(MonitorConfig.Build("Test")); gauge.GetAllMonitors().Should().HaveCount(1); gauge.GetAllMonitors().Single().Should().BeSameAs(gauge); }
public void Do_not_send_data_and_reset_when_nothing_registered() { var gauge = new GaugeAbsentFilter <long>(new LongGauge(MonitorConfig.Build("Test"))); gauge.GetValuesAndReset().ShouldBeEquivalentTo(new IMeasurement[0]); ((IGauge <long>)gauge).GetValuesAndReset().ShouldBeEquivalentTo(new IMeasurement[0]); }
public void Performance_counter_consists_of_a_single_value() { var monitor = new PerformanceCounterMonitor(MonitorConfig.Build("Test"), PerformanceCounterConfig.Build("Process", "Private Bytes", Process.GetCurrentProcess().ProcessName)); monitor.GetValues().Should().HaveCount(1); }
public void Health_check_consists_of_a_single_monitor() { var healthCheck = new HealthCheck(MonitorConfig.Build("Test"), () => true); healthCheck.GetAllMonitors().Should().HaveCount(1); healthCheck.GetAllMonitors().Single().Should().BeSameAs(healthCheck); }
public void Consists_of_a_single_monitor() { var counter = new BasicCounter(MonitorConfig.Build("Test")); counter.GetAllMonitors().Should().HaveCount(1); counter.GetAllMonitors().Single().Should().BeSameAs(counter); }
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]); }
public void Do_not_send_data_when_nothing_registered() { var counter = new CounterAbsentFilter <long>(new Counter(MonitorConfig.Build("Test"))); counter.GetValues().ShouldBeEquivalentTo(new IMeasurement[0]); ((ICounter <long>)counter).GetValues().ShouldBeEquivalentTo(new IMeasurement[0]); }
public void Send_data_when_registered(int someValue) { var gauge = new GaugeAbsentFilter <long>(new LongGauge(MonitorConfig.Build("Test"))); gauge.Set(someValue); gauge.GetValues().Single(); }
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 FilterCounter_send_data_when_registered_as_incrementamount(int someValue) { var counter = new CounterAbsentFilter <long>(new Counter(MonitorConfig.Build("Test"))); counter.Increment(someValue); counter.GetValues().Single(); }
public void Updating_the_value_updates_the_value_correctly(double expectedValue) { var gauge = new DecimalGauge(MonitorConfig.Build("Test")); gauge.Set(new decimal(expectedValue)); gauge.GetValues().First().Value.Should().Be(new decimal(expectedValue)); }
public void Updating_the_value_updates_the_value_correctly(long expectedValue) { var gauge = new LongGauge(MonitorConfig.Build("Test")); gauge.Set(expectedValue); gauge.GetValue().Should().Be(expectedValue); }
public void After_get_and_reset_the_value_is_still_gotten_from_func(int expectedValue) { var gauge = new Gauge <int>(MonitorConfig.Build("Test"), () => expectedValue); gauge.GetValuesAndReset(); gauge.GetValuesAndReset().First().Value.Should().Be(expectedValue); }
public FakeMonitor2(IEnumerable <Tag> tags = null) { Config = MonitorConfig.Build("test"); if (tags != null) { Config = Config.WithTags(tags); } }
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_Reset() { var gauge = new GaugeAbsentFilter <long>(new LongGauge(MonitorConfig.Build("Test"))); gauge.Reset(); gauge.GetValues().Single(); }
public void Send_data_and_reset_when_registered() { var gauge = new GaugeAbsentFilter <long>(new LongGauge(MonitorConfig.Build("Test"))); gauge.Set(33); gauge.GetValuesAndReset().Single(); }
public void Config_with_multiple_tags_in_one_call_has_all_the_tags_specified() { var expectedTags = new[] { new Tag("key", "value"), new Tag("key2", "value") }; var config = MonitorConfig.Build("Anything").WithTags(expectedTags); config.Tags.Should().BeEquivalentTo(expectedTags); }
public void FilterCounter_send_data_and_reset_when_registered() { var counter = new CounterAbsentFilter <long>(new Counter(MonitorConfig.Build("Test"))); counter.Increment(); counter.GetValuesAndReset().Single(); }
public void Incrementing_the_counters_works_as_expected(int amount) { var counter = new CumulativeCounter(MonitorConfig.Build("Test")); counter.Increment(amount); counter.GetValues().First().Value.Should().Be(amount); }
public void Incrementing_the_counters_works_as_expected(int amount) { var counter = new BasicCounter(MonitorConfig.Build("Test")); counter.Increment(amount); counter.GetValue().Should().Be(amount); }
public void Get_and_reset_gets_the_maximum_value() { const long expected = 100L; var gauge = new MinGauge(MonitorConfig.Build("Test")); gauge.Set(expected); gauge.GetValueAndReset().Should().Be(expected); }
public void Supplying_value_greater_than_previously_record_updates_the_value() { const long expectedValue = 1000; var gauge = new MaxGauge(MonitorConfig.Build("Test")); gauge.Set(expectedValue); gauge.GetValues().First().Value.Should().Be(expectedValue); }
public void Get_and_reset_sets_the_value_to_zero() { var gauge = new MinGauge(MonitorConfig.Build("Test")); gauge.Set(100L); gauge.GetValueAndReset(); gauge.GetValue().Should().Be(0L); }
public void Config_with_single_tag_specified_has_the_tag_attached() { const string key = "key"; const string value = "value"; var config = MonitorConfig.Build("Anything").WithTag(new Tag(key, value)); config.Tags.Should().HaveCount(1) .And.OnlyContain(x => x.Key == key && x.Value == value); }
public void Get_and_reset_returns_the_value(int amount) { var counter = new CumulativeCounter(MonitorConfig.Build("Test")); counter.Increment(amount); var value = counter.GetValuesAndReset(); value.First().Value.Should().Be(amount); }
public void Get_and_reset_does_not_reset_the_value(int amount) { var counter = new BasicCounter(MonitorConfig.Build("Test")); counter.Increment(amount); counter.GetValueAndReset(); counter.GetValue().Should().Be(amount); }
public void Get_and_reset_sets_the_value_to_zero() { var gauge = new DecimalGauge(MonitorConfig.Build("Test")); gauge.Set(100L); gauge.GetValuesAndReset().ToList(); gauge.GetValues().First().Value.Should().Be(0L); }