public void It_should_report_average_time_per_request_handled() { var statCollector = new InMemoryStatCollector(); var stats = statCollector.GetStats(); Assert.That(stats.NumRequestsHandled, Is.EqualTo(0)); statCollector.IncrementRequestsHandled(3, new TimeSpan(0, 0, 0, 0, 200)); statCollector.IncrementRequestsHandled(2, new TimeSpan(0, 0, 0, 0, 500)); stats = statCollector.GetStats(); Assert.That(stats.AverageTimePerRequestHandled, Is.EqualTo(new TimeSpan(0, 0, 0, 0, 320))); }
public void It_should_report_num_requests_handled() { var statCollector = new InMemoryStatCollector(); var stats = statCollector.GetStats(); Assert.That(stats.NumRequestsHandled, Is.EqualTo(0)); statCollector.IncrementRequestsHandled(3, new TimeSpan(0, 0, 0, 0, 200)); statCollector.IncrementRequestsHandled(2, new TimeSpan(0, 0, 0, 0, 500)); stats = statCollector.GetStats(); Assert.That(stats.NumRequestsHandled, Is.EqualTo(5)); }
public void It_should_report_error_rate() { var statCollector = new InMemoryStatCollector(); var stats = statCollector.GetStats(); Assert.That(stats.ErrorRate, Is.EqualTo(0)); statCollector.IncrementErrors(5); statCollector.IncrementRequestsHandled(15, TimeSpan.Zero); stats = statCollector.GetStats(); Assert.That(stats.ErrorRate, Is.EqualTo(25m)); }