public void CanDisposeMetricManagerMultipleTimes() { MetricManagerV1 manager = null; using (manager = new MetricManagerV1()) { } //Assert.DoesNotThrow manager.Dispose(); }
public void DisposingManagerCreatesAggregatedMetricTelemetry() { // Arrange var sentTelemetry = new List <ITelemetry>(); var client = this.InitializeTelemetryClient(sentTelemetry); using (MetricManagerV1 manager = new MetricManagerV1(client)) { MetricV1 metric = manager.CreateMetric("Test Metric"); metric.Track(42); // Act manager.Dispose(); // Assert Assert.AreEqual(1, sentTelemetry.Count); var aggregatedMetric = (MetricTelemetry)sentTelemetry.Single(); Assert.IsNotNull(aggregatedMetric); } }