コード例 #1
0
        public void PublishingMetricWorksCorrectly()
        {
            // arrange
            using (var httpDummy = new HttpMockFixture())
            {
                httpDummy.SetupServer();

                // act
                AppInsightClient.TrackMetric("Test", 12.2);
                AppInsightClient.Flush();

                // assert
                httpDummy.CallCount.Should().Be(1);
            }
        }
コード例 #2
0
        public void MetricIsNotPublishedIfPublishingIsDisabled()
        {
            // arrange
            using (var httpDummy = new HttpMockFixture())
            {
                httpDummy.SetupServer();
                AppInsightClient.TrackTelemetry = false;

                // act
                AppInsightClient.TrackMetric("Test", 10.5);
                AppInsightClient.Flush();

                // assert
                httpDummy.PathWasCalled.Should().BeFalse();
                AppInsightClient.TrackTelemetry = true;
            }
        }