示例#1
0
        public void HasChangesWhenNewIntegrationDisabled()
        {
            var collector = new IntegrationTelemetryCollector();

            collector.RecordTracerSettings(new ImmutableTracerSettings(new TracerSettings()));

            collector.GetData();
            collector.HasChanges().Should().BeFalse();

            collector.IntegrationDisabledDueToError(IntegrationId, "Testing!");
            collector.HasChanges().Should().BeTrue();
        }
示例#2
0
        public void HasChangesWhenNewIntegrationGeneratedSpan()
        {
            var collector = new IntegrationTelemetryCollector();

            collector.RecordTracerSettings(new ImmutableTracerSettings(new TracerSettings()));

            collector.GetData();
            collector.HasChanges().Should().BeFalse();

            collector.IntegrationGeneratedSpan(IntegrationId);
            collector.HasChanges().Should().BeTrue();
        }
示例#3
0
        public void DoesNotHaveChangesWhenSameIntegrationRunning()
        {
            var collector = new IntegrationTelemetryCollector();

            collector.RecordTracerSettings(new ImmutableTracerSettings(new TracerSettings()));

            collector.GetData();
            collector.HasChanges().Should().BeFalse();

            collector.IntegrationRunning(IntegrationId);
            collector.HasChanges().Should().BeTrue();
            collector.GetData();

            collector.IntegrationRunning(IntegrationId);
            collector.HasChanges().Should().BeFalse();
        }
示例#4
0
        public void WhenIntegrationRunsButDoesNotGenerateSpanHasExpectedValues()
        {
            var collector = new IntegrationTelemetryCollector();

            collector.RecordTracerSettings(new ImmutableTracerSettings(new TracerSettings()));

            collector.IntegrationRunning(IntegrationId);

            var data        = collector.GetData();
            var integration = data.FirstOrDefault(x => x.Name == IntegrationName);

            integration.Should().NotBeNull();
            integration.AutoEnabled.Should().BeTrue();
            integration.Enabled.Should().BeFalse();
            integration.Error.Should().BeNull();
        }
示例#5
0
        public void WhenIntegrationErrorsHasExpectedValues()
        {
            const string error     = "Some error";
            var          collector = new IntegrationTelemetryCollector();

            collector.RecordTracerSettings(new ImmutableTracerSettings(new TracerSettings()));

            collector.IntegrationRunning(IntegrationId);
            collector.IntegrationDisabledDueToError(IntegrationId, error);

            var data        = collector.GetData();
            var integration = data.FirstOrDefault(x => x.Name == IntegrationName);

            integration.Should().NotBeNull();
            integration.AutoEnabled.Should().BeTrue();
            integration.Enabled.Should().BeFalse();
            integration.Error.Should().Be(error);
        }