public void Passing_null_to_PushAsync_throws_ArgumentNullException() { var mh = new FakeMessageHandler(); using (var pushgateway = new PushGateway(new HttpClient(mh) { BaseAddress = new Uri("http://example.com/") })) { var m = new PrometheusMetrics(); Assert.ThrowsAsync <ArgumentNullException>(() => pushgateway.PushAsync(null, "jobname")); Assert.ThrowsAsync <ArgumentNullException>(() => pushgateway.PushAsync(m, null)); } }
public async Task Exposing_a_metric_includes_custom_metrics_without_timestamp() { var mh = new FakeMessageHandler(); using (var pgw = new PushGateway(new HttpClient(mh) { BaseAddress = new Uri("http://example.com/") })) { var m = new PrometheusMetrics(); var c = m.Counter().Name("test_counter").Help("This is the help text").Register(); c.Increment(); await pgw.PushAsync(m, "exampleapp"); mh.Content.Should().Contain("# HELP test_counter This is the help text\n"); mh.Content.Should().Contain("test_counter 1\n"); } }